I am wondering if its possible to display the ‘topic started’ and ‘topics posted to’ buttons for members on a non sp profile page? Would like them to function the same way they normally do and lead back to the forum search when clicked. Any advice will be appreciated.
Support Forum
Yes that is entirely possible. With one condition.
If you run the searches from your forum and copy the url that is in the address bar when the page loads you can use those urls anywhere you like.
The condition, however, is that the ‘value’ query variable has to be the ID of the current user or the user you wish to search for. So ‘topics started’ would look like this:
http://*your-domain*/*your-forum-name*/?search=1&new=1&forum=all&value=3&type=5
but that will display the topics started by user ID of 3. SO all is well as long you know the ID of the user… and can then construct the URL accordingly.
I did check out the url after running a search and saw the user ID included. Also took a look at the function sp_ProfileShowSearchPosts in the sp-profile-view-functions.php being used by sp for the searches. However, the code to accomplish this is beyond me. If it’s not too much trouble could you show me an example of how the ‘topics started’ could be done?
kind of hard to be exact or specific not knowing where you would put it…
but something like this where you want it:
<?php
global $current_user;
echo ‘<a href=”http://*your-domain*/*your-forum-name*/?search=1&new=1&forum=all&value=’.$current_user->ID.’&type=5″>Search</a>’;
?>
of course, this assumes there is a user… you could add a check for a user
if (!empty($current_user->ID)) …
before outputting the link to search… and you need to replace *your-domain* and *your-forum-name* with your site specifics…
Thanks that was exactly what I needed to figure out what I was trying to do
Profile pages are bp and the code I ended up using (minus the css) to get the buttons in the member-header of the pages was-
global $bp;
echo ‘<a href=”*your-domain*/*your-forum*/?search=1&new=1&forum=all&value=’.$bp->displayed_user->id.’&type=5″>Topics Started</a>’; ?>