Title: code query
Last modified: August 20, 2016

---

# code query

 *  [davidwood9999](https://wordpress.org/support/users/davidwood9999/)
 * (@davidwood9999)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/code-query/)
 * Hey pgogy –
 * I’m really fascinated by your code (which is WAY beyond this simple noob).
 * I found this snippet of your code:
 *  function ajax_action(){
    global $wpdb, $bp;
 *  $myrows = $wpdb->get_results(
    “SELECT forum_name, count(forum_name) as forum_count
   FROM ” . $wpdb->prefix . “bp_activity, ” . $wpdb->prefix . “bb_forums where forum_id
   = item_id and type like ‘new_forum_%’ and user_id='” . $bp->displayed_user->id.“‘”);
 * Would you be willing to tell me how to tweak this to echo:
    1) The total forum
   posts of current user for a SPECIFIC FORUM (e.g. forum_name=”Impact”), between
   STARTDATE and ENDDATE?
 * 2) The same query but for ALL user posts in that specific forum.
 * Would much appreciate your help.
 * If you like I’ll show you the end result – I’m going to TRY (lol) to link these
   results to google chart API to plot user posts over the last few days/weeks in
   that special forum, and graphed against total posts. (Whole idea being to encourage
   posting in this particular forum)
    D
 * [http://wordpress.org/extend/plugins/buddypress-activity-graphs/](http://wordpress.org/extend/plugins/buddypress-activity-graphs/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [pgogy](https://wordpress.org/support/users/pgogy/)
 * (@pgogy)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/code-query/#post-3536063)
 * Hi David,
 * I could modify the query for you no problem, however I am writing a group plugin
   that does the same as this one but for specific groups – would this solve the
   problem.
 * I am also thinking of making a management only one – guessing that might suit
   more?
 * Thanks
 * Pat
 *  Thread Starter [davidwood9999](https://wordpress.org/support/users/davidwood9999/)
 * (@davidwood9999)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/code-query/#post-3536064)
 * Hey Pat – good to hear from you.
 * I need it for a specific forum and a specific group. Actually there’s a thought–
   I just hired a guy to do a custom buddypress mod (would that be a plugin?) for
   me for $150. But I’m not sure if he’s any good. You interested in the job?
    I’ll
   post the specs below in case it’s something you’re interesting in. It’s an expansion
   of the concept of tallying # of posts, to something more sophisticated.
 * SPECS
    Buddypress Custom Tweak: STUDENT RESULTS TRACKING FEATURE
 * For buddy press members of the new Group “CoachMBA”:
 * 1) Create a separate nav TAB called “My Results!”. two sub navs under this are“
   My Results” and “All Results”. By default My Results sub nav is selected.
    When
   students click this they see the following statistics personal to them (will 
   be stored in database): a) Total “Invites to a Free Consultation” extended b)
   Total Free Consultations given c) Total Impact Points awarded by prospects (/
   10 based on the consultation) d) Total Clients Signed up e) Total Income Received
   f) [CALCULATED] “Consultation Acceptance Rate” (b divided by a) g) Av Impact 
   Points per consultation (c/b) h) [CALCULATE] “Client Conversion Rate” (d/b) i)[
   CALCULATED] Average Income Per Client (e/d)
 * – Allow member checkbox to keep their information private from other members (
   but not admin).
 * – Clickable link so they can UPDATE the running totals a) through e)
    (everyone
   starts at 0 by default) i.e. students create their own statistics.
 * – When the number of clients increases during update, a cute animation is played(
   I have this) to reward them!
 * – Next to each statistic, also show the average, min and max of EACH of these
   stats across entire group (so they can compare to others)
 * – By default stats are tallied over all time, but member can also choose date
   range for their stats in this area.
 * – When they click the “All Results” sub nav, member (and admin) can show/graph
   a particular statistic across ALL group members
    – drop down box to select from
   the 9 stats above – boxes to select date range (default is all time) – fixed 
   sorting is high to low (e.g. you can show a bar graph of the client conversion
   rate for all students.) – it’s possible to tell from the legend which member 
   a stat belongs to, unless they have selected private option. (Would be nice if
   they can click on the student and go straight to his results page, but I doubt
   the google API provides an image map lol! So no need). – strongly suggest the
   free Google API be used for this.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [13 years, 2 months ago](https://wordpress.org/support/topic/code-query/#post-3536065)
 * > But I’m not sure if he’s any good. You interested in the job?
 * Sorry but this is not the place to post a job spec. And per forum rules I am 
   now closing this topic.
 * [http://codex.wordpress.org/Forum_Welcome#Offering_to_Pay](http://codex.wordpress.org/Forum_Welcome#Offering_to_Pay)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘code query’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/buddypress-activity-graphs_ef8f79.
   svg)
 * [Buddypress Activity Graphs](https://wordpress.org/plugins/buddypress-activity-graphs/)
 * [Support Threads](https://wordpress.org/support/plugin/buddypress-activity-graphs/)
 * [Active Topics](https://wordpress.org/support/plugin/buddypress-activity-graphs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/buddypress-activity-graphs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/buddypress-activity-graphs/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/code-query/#post-3536065)
 * Status: not resolved