Filter gifts by user
-
I’m using an older gifts plugin with buddypress to allow users to send gifts to each other. I’m currently trying to make it so if you’re logged in, you can see all the gifts you’ve been gifted, while if I go to someone’s page, I will only see the gifts I gifted them.
I’ve pasted my code below. Logically to me this makes sense; each
<li>
is a different gift from a user. I am trying to make it so if the returned result has the sameid
as the current user, display that<li>
. I am beginning to think I am on the wrong file (before anyone says not to edit plugin files, this plugin has deprecated 2 years already).Any idea?
<?php global $wpdb; global $bp; $cur_user = $bp->loggedin_user->id; $profile_user = $bp->displayed_user->id; $result = $wpdb->get_results("SELECT * FROM wp_bp_activity WHERE item_id=" . $profile_user . " AND component='gifts'"); ?> <ul id="activity-stream" class="activity-list item-list" style="list-style-type: none;"> <?php //loop through ID's foreach ($result as $results) { ?> <?php while ( bp_activities() ) : bp_the_activity(); ?> <?php if ( $results->user_id == $cur_user ) { ?> <li class="<?php bp_activity_css_class(); ?> message" id="activity-<?php bp_activity_id(); ?>">...</li> <?php } //end if endwhile; } //end foreach ?> </ul>
- You must be logged in to reply to this topic.