Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 45 total)
  • Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi Modemlooper-

    My theme is a child theme of Twenty Twelve, so my style.css declares Template: twentytwelve.

    I followed your suggestion then took it a step farther and included slightly modified version of the js setup functions from the template pack in my `functions.php` file. I’ll post them here in case somebody else has the same problem I’m having:

    `function bp_support_theme_setup() {
    global $bp;

    // Load the default BuddyPress AJAX functions if it isn’t explicitly disabled or if it isn’t already included in a custom theme
    if ( ! function_exists( ‘bp_dtheme_ajax_querystring’ ) )
    require_once( BP_PLUGIN_DIR . ‘/bp-themes/bp-default/_inc/ajax.php’ );

    // Let’s tell BP that we support it!
    add_theme_support( ‘buddypress’ );

    if ( ! is_admin() ) {
    // Register buttons for the relevant component templates
    // Friends button
    if ( bp_is_active( ‘friends’ ) )
    add_action( ‘bp_member_header_actions’, ‘bp_add_friend_button’ );

    // Activity button
    if ( bp_is_active( ‘activity’ ) )
    add_action( ‘bp_member_header_actions’, ‘bp_send_public_message_button’ );

    // Messages button
    if ( bp_is_active( ‘messages’ ) )
    add_action( ‘bp_member_header_actions’, ‘bp_send_private_message_button’ );

    // Group buttons
    if ( bp_is_active( ‘groups’ ) ) {
    add_action( ‘bp_group_header_actions’, ‘bp_group_join_button’ );
    add_action( ‘bp_group_header_actions’, ‘bp_group_new_topic_button’ );
    add_action( ‘bp_directory_groups_actions’, ‘bp_group_join_button’ );
    }

    // Blog button
    if ( bp_is_active( ‘blogs’ ) )
    add_action( ‘bp_directory_blogs_actions’, ‘bp_blogs_visit_blog_button’ );
    }
    }
    add_action( ‘after_setup_theme’, ‘bp_support_theme_setup’, 11 );

    /**
    * Enqueues BuddyPress JS and related AJAX functions
    *
    * @since 1.2
    */
    function bp_support_enqueue_scripts() {

    // Add words that we need to use in JS to the end of the page so they can be translated and still used.
    $params = array(
    ‘my_favs’ => __( ‘My Favorites’, ‘buddypress’ ),
    ‘accepted’ => __( ‘Accepted’, ‘buddypress’ ),
    ‘rejected’ => __( ‘Rejected’, ‘buddypress’ ),
    ‘show_all_comments’ => __( ‘Show all comments for this thread’, ‘buddypress’ ),
    ‘show_all’ => __( ‘Show all’, ‘buddypress’ ),
    ‘comments’ => __( ‘comments’, ‘buddypress’ ),
    ‘close’ => __( ‘Close’, ‘buddypress’ )
    );

    // BP 1.5+
    if ( version_compare( BP_VERSION, ’1.3′, ‘>’ ) ) {
    // Bump this when changes are made to bust cache
    $version = ’20120412′;

    $params['view'] = __( ‘View’, ‘buddypress’ );
    $params['mark_as_fav'] = __( ‘Favorite’, ‘buddypress’ );
    $params['remove_fav'] = __( ‘Remove Favorite’, ‘buddypress’ );
    }
    // BP 1.2.x
    else {
    $version = ’20110729′;

    if ( bp_displayed_user_id() )
    $params['mention_explain'] = sprintf( __( “%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.”, ‘buddypress’ ), ‘@’ . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) );
    }

    // Enqueue the global JS – Ajax will not work without it
    wp_enqueue_script( ‘dtheme-ajax-js’, BP_PLUGIN_URL . ‘/bp-themes/bp-default/_inc/global.js’, array( ‘jquery’ ), $version );

    // Localize the JS strings
    wp_localize_script( ‘dtheme-ajax-js’, ‘BP_DTheme’, $params );
    }
    add_action( ‘wp_enqueue_scripts’, ‘bp_support_enqueue_scripts’ );
    `

    Which is identical to installing the template pack only for the JS, I think. Everything’s working as expected, so I think we can consider this problem resolved. Thanks for your attention, Hugo and Modemlooper.

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Still didn’t work. Available here: http://pastebin.com/ZtFWhqyg

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Well that code bit got mixed up, let’s try that again:

    `<a href="” title=”Log out”>`

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi Patty-

    Have you tried using `home_url()` instead of `site_url()` like the example on the Codex: http://codex.wordpress.org/Function_Reference/wp_logout_url#Logout_and_Redirect_to_Homepage

    I use this on my site and it redirects to the home page:
    `<a href="” title=”Log out”>`

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi Hugo-

    You just cleared something important up for me: The new file structure is not just a restructuring of where the files are, but also within the files themselves. (And the files in /buddypress/bp-templates/bp-legacy/buddypress/ are the new style. Are these the template files that theme compat uses, too?)

    Yes, I built this theme the old way, where you create a child theme of whatever (I used Twenty Twelve), then copied the templates and css over from bp-default into the child theme, then went to work. It’s not a child theme of bp-default (precisely, but more or less). The BP Template Pack took care of the JS with BP1.6.

    I’ve tried adding theme support and the js file, but as you mentioned earlier, it also needs ajax.php to do the work. (I don’t know how to make that happen.)

    Thanks,

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi Hugo-

    I came across this comment on trac that appeared to be in the wrong place but sounded similar to my problem: http://buddypress.trac.wordpress.org/ticket/4869#comment:17

    I’ve found that if I install Boone’s GitHub version of the template pack and only enable the JS file portion of it, it works (if my buddypress templates are back at the root of the theme, not in a buddypress folder).

    Is there a better way? (I’m also concerned that 1.7 is going to unexpectedly break a number of customized themes like mine.) What’s funny about this is that with 1.6 I used the template pack, then deactivated it while working with 1.7-beta, but it appears that I need it again.

    Thanks for your help,

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi Hugo-

    Thanks for following up. The theme was built against BP1.6 & 1.7-beta, so the buddypress-related template folders (activity, blogs, groups, etc) were in the root of the theme. This resulted in the theme being rendered correctly, but, with BP1.7, the js support disappeared.

    I’ve moved the bp-related folders into a “buddypress” folder at the root of the theme (as described in your article: http://codex.buddypress.org/developer/theme-development/a-quick-look-at-1-7-theme-compatibility/). Moving the files causes the output to be garbled. For instance, on a single member’s profile page, a div#content is being created inside of the div#content provided in the main template `buddypress.js`, and, while the object-nav (activity, messages, etc) is being rendered, the header and the main content area aren’t being populated. Structurally, it’s like the entire buddypress output is being wrapped in the theme’s page template. But not completely, because the end of the file isn’t being rendered.

    As you can tell, I’m not exactly sure what’s going on. :)

    Thanks again for your advice,

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi Hugo-

    Thanks for your reply. I’m not doing anything to prevent theme compat from running (as far as I know–I thought that add_theme_support(‘buddypress’) was the flag to stop compat, and I’m not setting that).

    Basically, I’ve provided php and css files via my theme but would like the js bits to continue to be provided by BP.

    I thought I understood how theme compat worked via the 1.7-betas (my theme behaved just like it did under 1.6.x), but it seems to be different with the actual release.

    Is there a document somewhere describing what triggers/short-circuits theme compat, so I can know either how to get BP to provide the theme compat via js, or, alternatively, duplicate the right files from bp-default into my theme to get the functionality back?

    Thanks again for your reply,

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Should have mentioned: Using WP 3.5.1 with BP 1.7. This is on a closed dev site (production site is still running 1.6.x perfectly, so I’m not freaking out or anything.) Thanks again for your help.

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    I’d try flushing the permalinks settings.

    Visit the WP admin dashboard > Settings > Permalinks. Don’t change anything, but click “Save Changes.” This will refresh the permalinks, and in many cases, straighten out the problem you’re having.

    -David

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Also consider the honey pot method. It catches automated spammers but not human spammers.
    https://github.com/pixeljar/BuddyPress-Honeypot

    For human spammers you almost need to approve each user request. Which is a pretty big barrier to entry, I think. I’ve used this plugin to do that:
    http://wordpress.org/extend/plugins/bp-registration-options/

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    You can use BuddyPress Humanity to stop bots:
    http://wordpress.org/extend/plugins/buddypress-humanity/

    or the honey pot method: https://github.com/pixeljar/BuddyPress-Honeypot

    If necessary, you can manually approve users:
    http://wordpress.org/extend/plugins/bp-registration-options/

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    I’ve found that BP Humanity helps with spam robots but not human spammers.
    http://wordpress.org/extend/plugins/buddypress-humanity/

    For human spammers, you may need to approve each user.
    http://wordpress.org/extend/plugins/bp-registration-options/

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    I think a better bet is to collect that info on the BP registration page and then not display it on the user profile (that way you’ll still be able to use it in other ways). With BP 1.6. you can change the visibility of each xprofile field to friends only, logged-in users, or public (and force that level or allow the user to override your selection). (Visible to admin only is coming in BP 1.7, btw, which would totally fix you up.) At the moment, you can modify your theme template file (themes/yourtheme/members/single/profile/profile-loop.php) to hide some fields like this:
    `about line 17:

    <?php $no_display_fields = array( // Enter the field name of any field that you don't want to appear on the user profile.
    ‘E-mail’,
    ‘Name of Field Hide’,
    ‘Another’
    );

    if ( bp_field_has_data() && !in_array( bp_get_the_profile_field_name(), $no_display_fields ) ) : ?>`

    It’s a hack, but it works for me (until BP 1.7).

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Bump?

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Since registration involves a redirect to another page, why not attach your function to `init`, which is fired when a WP page is starting to load?

    `function get_member_ID() {
    global $current_user;
    get_currentuserinfo();
    $ID = $current_user->ID;
    // Do stuff with user ID.
    }
    add_action(‘init’, ‘get_member_ID’);`

    Or you could do something when the user logs in:

    `function get_member_ID_login() {
    global $user;
    $user->ID;
    // Do stuff with user ID.
    }
    add_action(‘wp_login’, ‘get_member_ID_login’, 100, 3);`

    There are some hooks in the registration process, too, I’m just not familiar with them.

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    I made changes to the WP Admin Bar by adding this snippet to my theme’s `functions.php` file:

    `// Customize WP Toolbar
    function change_toolbar($wp_toolbar) {
    $wp_toolbar->remove_node(‘my-account-forums’);
    }

    add_action(‘admin_bar_menu’, ‘change_toolbar’, 999); `

    You can remove any individual li by getting the id of it (in your case the li has the id `wp-admin-bar-my-account-forums`) and dropping the prefix `wp-admin-bar-`. The part where you remove the prefix is odd and makes it kind of a secret, but it works. I got the original idea here: http://www.sitepoint.com/change-wordpress-33-toolbar/

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    To display extended profile fields in the members directory, it’s easiest to add a function to your theme’s `functions.php` file. My theme is based on the bp-default theme, so in my file `/wp-content/themes/theme-name/members/members-loop.php`, there’s this action at the end of each member’s entry that we can hook into:

    Open up your functions.php file and add something like this:
    `function add_member_custom_extended_profile() {
    if ( $xprofile_tele = bp_get_member_profile_data( ‘field=Telephone’ ) ) {
    echo ‘

    Telephone:’ . $xprofile_tele . ‘

    ‘;
    }
    }
    add_action(‘bp_directory_members_item’, ‘add_member_custom_extended_profile’); `

    You can get the exact field name to use by looking at a member’s profile page and copying the text in the left-most column.

    I originally got this idea from here: http://premium.wpmudev.org/forums/topic/bp-add-profile-field-data-to-members-directory-with-links

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Any ideas?

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    A popular way to do this is with a plugin:
    http://wordpress.org/extend/plugins/search.php?q=search+bbpress

    Some integrate the bbPress search with the WP search, some keep them separate; both ways make sense on different sites.

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Go to BuddyPress > Pages in your WordPress Admin menu. You should have a page selected (dropdown menus) for each line. If nothing is selected next to “Activity”, and there’s not a good page to use in the dropdown, use the “New Page” button. All you need to do is name the page and save it; it doesn’t need to have any content. Then, go back to BuddyPress > Pages and select the page you want to use. BP takes care of almost everything, including creating the correct activation link, if you tell it which page to use. :)

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    The link should be http://www.myswayspot.com/activate/?key=5fe52bf2f614ef393d2cef3e44765415 by default. Do you have an activate page set up (BuddyPress>Pages)? Are you using permalinks in WP? Which setting? Maybe try disabling permalinks and making a new user…

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    @djpaul WP pages are fine ( look like /members ). Group creation is fine ( /groups/(group name)/ )
    Accept group invitation links look like `/members/(member name)/groups/invites/accept/4(this is the correct id for the group I’m trying to join)?_wpnonce=(nonce removed by me because it seems like bad security to share?)`
    Working local version link looks like `/members/(member name)/groups/invites/accept/4(correct id)?_wpnonce=(hidden)`
    They seem to be identical, but MAMP knows how to handle it where IIS fails.

    Site is here: http://members.communitycommons.org/

    Thanks for any advice you can give.

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    @mercime It’s been a little frustrating because everything works perfectly in MAMP and on my testing server (Linux), then there are problems on the production server. I think the problem is in the redirect module, but I don’t know the first thing about fixing that kind of problem on IIS. Thanks for your reply.

    Avatar of dcavins
    dcavins
    Participant

    @dcavins

    Hi @mercime-

    Thanks for your reply.

    Latest versions of BP/WP (3.3.1/1.5.3.1). The problem install is Windows hosted (MAMP install is Linux, of course). New install. I set the db up on the server fresh, and only imported posts to it, not settings. As part of troubleshooting, I imported the server install db into an empty MAMP install, and everything worked fine. It only seems to fail on the Windows server.

    Thanks,

    -David

Viewing 25 replies - 1 through 25 (of 45 total)