Skip to:
Content
Pages
Categories
Search
Top
Bottom

Allowing non-registered users to post to activity stream


  • kizinko
    Participant

    @kizinko

    I am making a site where I want both registered and non-registered users to be able to visit a group and post into the activity stream for that particular group.

    Ideally, it would ask them to enter their name to post, but it would still work if activity posts by non-registered users just went under the name “Anonymous”. Thus allowing new visitors to the site to see how it operates before signing up. I have been looking everywhere for a solution to this issue, but have not been able to find anyone or anything to help. A plugin would be good, but if anyone has an advanced knowledge of BP scripting I would love to know where in my code I could go to make this happen.

    Please keep in mind if you respond to this topic that it is NOT regarding normal WP posts, but specifically the activity of a group within BuddyPress.

    Thanks in advance!

Viewing 1 replies (of 1 total)

  • kizinko
    Participant

    @kizinko

    I took this issue to a buddy of mine and he found the answer. The first thing you need to do is create an anonymous user. Then access your database and find the user_id value for that user. In this example the user_id is 7. You’ll notice in the last step that we are setting the user_id to 7 if no one is logged in.

    wp-content/plugins/buddypress/bp-themes/bp-default/_inc/ajax.php
    Comment out line 118
    `
    /*if ( !is_user_logged_in() ) {
    echo ‘-1’;
    return false;
    }*/
    `

    wp-content/plugins/buddypress/bp-themes/bp-default/groups/single/activity.php
    Pull locate_template out of if statement line 31

    wp-content/plugins/buddypress/bp-groups.php
    At line 1952 add
    `if( empty($user_id) )
    $user_id = 7;`
    And
    `
    if ($user_id != 7)
    {
    /* Be sure the user is a member of the group before posting. */
    if ( !is_super_admin() && !groups_is_user_member( $user_id, $group_id ) )
    return false;
    }
    `

    All of the credit goes to Jonathan Creamer from jcreamerlive.com!

Viewing 1 replies (of 1 total)
  • The topic ‘Allowing non-registered users to post to activity stream’ is closed to new replies.
Skip to toolbar