andrew55 (@andrew55)

Forum Replies Created

Viewing 25 replies - 26 through 50 (of 62 total)
  • @andrew55

    Participant

    OK, forget my additional code. Can someone please let me know what snippet (just for bbBress) to show something only in the profile area of the reply author, only if it applies to them.

    In other words: “show if it applies to this specific reply author.”

    I’ve edited loop-single-reply.php with great results for similar features.

    Thanks for any suggestions.

    @andrew55

    Participant

    I don’t mean to ramble, but I think the solution will be something such as:

    if (Am_Lite::getInstance()->haveSubscriptions(364) && ($reply_user_id($topic_id) ))

    I just add bbpress statement to my already existing “if” statement using an “And” operator.

    I’m just getting caught up on the bbpress part.

    Any suggestions on what the bbpress code would be to “just show for the author of this reply?”

    Thanks for any help.

    @andrew55

    Participant

    I seems like this should work, but it doesn’t:

    <?php
    if (bbp_get_reply_author_id($reply_id))
    {
    ?>
    
    my other code goes here
    
    <?php
    }
    ?>

    It seems like it should wrap my code with a statement of “show only for the author of this reply” but it’s not working like this.

    Any suggestions on what the code would be to “just show for the author of this reply?”

    Thanks for any help.

    @andrew55

    Participant

    tvirtual – did you ever get this resolved? Sounds like you need to be using the aMember login form, not bbPress login form.

    I have integrated the two scripts nicely and would be glad to help (if you still need it). aMember support through tickets is also top notch.

    @andrew55

    Participant

    Got it! This seems to work:

    <?php
    $reply_user_id = bbp_get_reply_author_id();
    global $wp_roles;
    $reply_user = new WP_User( $reply_user_id );
    $roles = $reply_user->roles;
    $role = array_shift($roles);
    if  ($role == 'graduate' ){
    echo "<a href='http://www.mysite.com/page2/'>Graduate</a>";
    }
    ?>

    @andrew55

    Participant

    This also seems like it should work to me:

    <?php
    $user = new WP_User( bbp_get_reply_author_id() );
    if  ($role == 'Graduate' ){
    echo "<a href='http://www.mysite.com/page2/'>Graduate Link</a>";
    }
    ?>

    But it’s still not showing link in replies for uses who have “graduate” role. Any suggestions?

    @andrew55

    Participant

    This is the best I’ve come up with so far, but it’s not working yet. Seems like this should work properly. It’s still getting printing the link in profile area in the replies:

    <?php
    $reply_user_id = bbp_get_reply_author_id();
    global $wp_roles;
    $reply_user = new WP_User( $reply_user_id );
    $roles = $reply_user->roles;
    $role = array_shift($roles);
    if ($user_role == 'graduate') {
    echo "<a href='http://www.mysite.com/page2/'>Graduate Link</a>";
    }
    ?>

    Thanks for any suggestions on how to get it right.

    @andrew55

    Participant

    kachan64 – thank you. That is a good start. My main issue at this point seems to be that roles I’m using aren’t bbpress roles, so how I need to pull them is different. I will keep working at it.

    In reply to: reformatting ALL CAPS

    @andrew55

    Participant

    I tested this plugin: FriendlyCase

    And unfortunately, it doesn’t seem to be compatible with bbPress.

    @andrew55

    Participant

    Actually, this isn’t working right. I prevents any topic/replies from being posting on activity walls at all. I guess it’s back to the drawing board.

    I’m wondering if this might do it – putting a div class around the topic/reply content in the template files of bbPress, and then only hiding this div in BuddyPress. But then I’m thinking it might result in the same issue – nothing topic/replies show in activity wall at all.

    @andrew55

    Participant

    @robkk – thanks for the clarification.

    @andrew55

    Participant

    I’m still testing, but I think this does it:

    .activity-list li.bbp_topic_create .activity-content .activity-inner, .activity-list li.bbp_reply_create .activity-content .activity-inner {
    	display: none !important;
    }

    It shows bbPress forum titles in BuddyPress activity streams, but not content of the reply/post.

    Hope this helps anyone who might need it.

    @andrew55

    Participant

    This is exactly the same issue I found. So I guess it’s not just some strange issue on our site.

    Thanks for your efforts.

    @andrew55

    Participant

    My guess is that this has to do with the forums being imported from phpBB? Since import, when a new topic is created or replied to, I notice it’s freshness is accurate.

    So I guess I’ll just hide the freshness until we get some more activity (just so members don’t get confused). I’m still very very happy with bbPress!

    @andrew55

    Participant

    Sure: https://www.lifeleap.org/community/

    For example, at the bottom forum (Metaphysical Healing), it says the last activity was 2 years, 9 months ago. But if you open forum, you will see last activity was very recent.

    @andrew55

    Participant

    Thanks for the tip!

    @andrew55

    Participant

    Hey – thanks for at least looking into it. If that’s the worst limitation of bbPress, I have no complaints!

    I was just asking here because I thought there might be a simple solution. I guess I could hire a coder and post the fix back here.

    @andrew55

    Participant

    Got it – This seems to work for showing the first role:

    <?php
    $user = new WP_User( bbp_get_reply_author_id() );
    echo $user->roles[0];
    ?>

    @andrew55

    Participant

    I’m very happy to have found this – very useful.

    Question – any suggestions on how to adjust the code to where subscribers can also view the role of other users.

    Thanks for any help.

    @andrew55

    Participant

    Got it: loop-single-reply.php

    @andrew55

    Participant

    Wow – thanks for taking the time to create this. Much appreciated. I’m a realist, not so much of a purist!

    Unfortunately, I am getting this error in the profile area of all topics and replies:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'andrew55_insert_field ' not found or invalid function name in /home/mysite/wp-includes/plugin.php on line 496

    I tried function with both “bbp buddypress profile information” and “bbp profile information” installed.

    Another idea – instead of pestering for help with advanced php functions, what about just throwing the snippet I have in a template file in my child theme?

    I’ve been looking, but I can’t find the correct template file that controls the “user profile area” for the topics and replies when viewing a single topic. Any suggestions on where I might find this file so I can give it a try? It seems like it would be loop-single-topic.php, but that is for the view for all the topics together.

    I’m still new to bbPress and am finding it tricky to learn my way around the files – but I’m getting there!

    Thanks for any suggestions.

    @andrew55

    Participant

    Thanks – this is a great start. Although, my skill level just isn’t there yet with writing functions for WordPress. Here is the php snippet I have that will create the value I need to have displayed in profile area of topics and replies:

    <?php
    require_once '/home/site/public_html/amember/library/Am/Lite.php';
    if (Am_Lite::getInstance()->haveSubscriptions(2))
    {
    ?>
    <p>custom text 1</p>
    <?php
    }
    else {
    if (Am_Lite::getInstance()->isLoggedIn())
    {
    ?>
    <p>custom text 2</p>
    <?php
    }
    else {
    ?>
    <p>custom text 3</p>
    <?php
    }
    }
    ?>

    If anyone is willing to help, that would be great.

    @andrew55

    Participant

    Thanks for checking it out. I think it would be less confusing for users if topic doesn’t show twice.

    @andrew55

    Participant

    Robkk – thanks for the clarification. I’m getting a better grip now on how bbPress is set up. Although, in another forum I am working on, sometimes the stickies show up twice, but sometimes they don’t?

    Question: So if stickies do show up twice normally, is there are method to get them to only show at beginning of topic (top of page)?

    In the “list of topics” view, if it doesn’t have many topics and there is a sticky, the user will see the same topic twice on the same page (once at the top in the sticky area, and again below in the topic list area. Is there a method to prevent this redundancy. It’s not a huge deal, but it seems to me it will improve user experience.

    Thanks for any suggestions.

    @andrew55

    Participant

    Thanks for the reply. I don’t “think” this a archive scenario, unless I am misunderstanding how archives work.

    Here is one of the topics in question (it’s a sticky, not a super sticky):
    https://www.lifeleap.org/newcommunitysite/forums/topic/read-before-asking-any-psychic-questions-in-a-post/

    The topic is a sticky here:
    siteurl/newcommunitysite/forums/forum/lifeleap-cafe/free-psychic-questions/

    But it also shows up here:
    siteurl/newcommunitysite/forums/forum/lifeleap-cafe/free-psychic-questions/page/2/

    (I tried to post all links, but bbpress wouldn’t let me)

    Thanks for any suggestions.

Viewing 25 replies - 26 through 50 (of 62 total)