Azinfiro (@azinfiro)

Forum Replies Created

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

  • Azinfiro
    Participant

    @azinfiro

    Thank you for the quick, helpful reply. Sorry I didn’t get back to you sooner.

    I would like to count each subscribed forum and subscribed/favorite topic but not every topic within a subscribed forum, though with a few technical exceptions.

    In my case, WP__bbp_subscriptions and WP__bbp_favorites only output topics, not forums or the topics of a subscribed forum.

    Fortunately, I found three functions that provide either subscribed forum ids or subscribed/favorite topic ids separately, based on a user id:

    bbp_get_user_subscribed_topic_ids()
    bbp_get_user_subscribed_forum_ids()
    bbp_get_user_favorites_topic_ids()

    Here is my solution in the form of two custom functions. The above functions obviously made it all very simple:

    // display bbPress subscription count
    function user_subscriptions_count( $user_id = null ) {
    
    	$topic_count = count(bbp_get_user_subscribed_topic_ids($user_id));
    	
    	$forum_count = count(bbp_get_user_subscribed_forum_ids($user_id));
    	
    	echo  $forum_count + $topic_count ;
    }
    // display bbpress favorites count
    function user_favorites_count( $user_id = null ) {
    
    	echo count(bbp_get_user_favorites_topic_ids($user_id));
    }

    I do realize that a user’s subscribed forums and topics are usually private, but I prefer to check for permissions outside functions.

    Thanks for the help, I hope this might be useful for someone in the future.


    Azinfiro
    Participant

    @azinfiro

    I will if I find an acceptable solution. It would be better if one of the developers could drop by and share their wisdom though.

    There is also a small chance that BuddyPress Trac ticket #5619 will materialize and effectively solve my problem before I do.

    Anyway, thanks for the help!


    Azinfiro
    Participant

    @azinfiro

    Right, I guess I’m moving on to the Stack Exchange. Worst case, I’ll have to figure out how PHP forms are done in general, figure out some MySQL in relation to WordPress and sprinkle with security precautions.

    Do you have a donation link? I don’t think anybody else is going to drop by and help me out before I figure it out elsewhere πŸ™‚


    Azinfiro
    Participant

    @azinfiro

    Gotcha, glad we’re on the same page now. πŸ™‚

    What happens when I rename the form-user-edit.php to settings.php and drop it in the right directory is that I get the right markup, but the forms don’t work when submitted. They also don’t display any pre-submitted values like they would if they did work.

    In fact, they don’t work anywhere except at their original location at example.com/forums/profile/%username%/edit so it doesn’t really matter whether I’m trying to make them work in BuddyPress or any other page.

    I’m sure it’s just a matter of understanding how WordPress or specifically BuddyPress implement PHP forms and the rest should be a cakewalk.


    Azinfiro
    Participant

    @azinfiro

    is this what you are describing as the template file? and which file is that and is it a php file?

    Let’s start with this. The file is a BuddyPress template file called settings.php. It’s wiped clear of any code though. You can find it in buddypress/bp-templates/bp-legacy/buddypress/members/single if you have downloaded BuddyPress.

    This template file controls the BuddyPress user Settings page and I am trying to turn it into a working copy of the bbPress user Edit page.

    ok, so if I understand you correctly, you are trying to have the links that are … and place them on a buddypress page?

    I can’t figure out why you’re listing the URLs you mentioned in above quote again. I’m really sorry if I’m missing something, but I feel like I need to reaffirm that this is not what I’m doing.


    Azinfiro
    Participant

    @azinfiro

    Thanks for the reply.

    I can’t actually access the BuddyPress Settings page in the backend. Are you suggesting I use the shortcode inside the template file?

    I’m making a theme, so I would really prefer not to rely on plugins. Besides, I would love to know how the form-user-edit.php actually works. πŸ™‚

    Can you say what I need to edit or add to the content of form-user-edit.php get to get it to work somewhere else?

    I’m not sure what you mean by calling each by their url. Can you elaborate?


    Azinfiro
    Participant

    @azinfiro

    The site is hosted locally so I can’t give you an actual live URL if that’s what you mean?

    The page is a ‘customized’ version of the BuddyPress Settings page located at DOMAIN/members/USER/settings/.

    Just think of it as a blank WordPress page with that URL.

    By “the content” I mean the <form id="bbp-your-profile> element, and everything within it, on the Edit page at DOMAIN/forums/profile/USER/edit/.

    The template file that contains the form is called form-user-edit.php.


    Azinfiro
    Participant

    @azinfiro

    my wife would be delighted if I had a six pack, but suspect that’s not what you are talking about !

    I hear you can get crafty six pack-making belts on the shop***g channel that work wonders at the same price though! πŸ™‚

    Is that correct?

    Not exactly, I’m trying to move the content of the edit page from bbPress over to the settings page on BuddyPress, or any other page for that matter.

    Maybe I should add that I’m making a custom WP/BBP/BP theme, so if it’s something that can easily be done by working with the template files as opposed to drawing up plugins then I’m happy to do it that way.

    I started reading up on how PHP forms work, but I figure it’s safer to ask someone who knows what they’re doing when it comes to things like user inputs.


    Azinfiro
    Participant

    @azinfiro

    Okay, let’s raise the stakes.

    I will donate a six pack to whoever successfully helps me get this to work within a reasonable time frame.

    I hope it’s okay to do that here?


    Azinfiro
    Participant

    @azinfiro

    Bump


    Azinfiro
    Participant

    @azinfiro

    Okay, please post the solution here if you figure it out. πŸ™‚

    If you can’t get a filter to work, you can always look at customizing a template file or two if you don’t need it to work across different themes.


    Azinfiro
    Participant

    @azinfiro

    Thanks for the tip, I’ll keep that in mind.


    Azinfiro
    Participant

    @azinfiro

    Actually, there is a link to the topic by default, in which case it’s the number in the top right corner of the reply.

    Here on the bbPress support forum, it’s the time stamp to the left of the reply, underneath the user’s profile information.

    Linking to replies, posts, etc. like it’s done here is fairly common practice throughout the web, although not at all intuitive in my opinion.


    Azinfiro
    Participant

    @azinfiro

    Will do. Thanks for the help anyway! πŸ™‚


    Azinfiro
    Participant

    @azinfiro

    No, I mean words from the content.

    Don’t worry about it though, it’s a low priority, even for me.

    I’m also starting to have second thoughts about it now that I’ve only been able to find one example of it being used in production.

    I’ll keep looking at the material you posted along with the bbp and wp codices though.


    Azinfiro
    Participant

    @azinfiro

    Thank you for the reply.

    I just realized that the Steam Forums I linked to don’t actually do what I’m talking about. I’m gonna see what I can do with wdgets.php the plugin you linked to, but just to clarify:

    I’m looking for the first couple of words from the most recent post of each forum to be displayed under “Freshness” on the front page and on forum lists, etc.

    I’ll figure out the PHP I need to, so don’t worry about that πŸ™‚


    Azinfiro
    Participant

    @azinfiro

    It would be great to have an alternative to the Groups feature in BuddyPress so you’re not forced to use their extensive override of the bbPress profiles, which is not that well designed if you’re not interested in the rest of the package.

    I can’t contribute much in the form of PHP development, but please ask if you think I could help out some other way.

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