Forum Replies Created
-
In reply to: Notify a user about a page is viewed
Hi @bacigaloop
Posts are displayed by single.php. Take a look in your theme to see if there is a hook available in that file. If not you could always add one yourself by creating a child theme.
In reply to: [Resolved] Warning message on my activity pageHi @flaviamelo
BuddyPress doesn’t have a
Login_Helperclass or achange_buddypress_avatarmethod. Which plugins are you using? This is 99.99% likely to be due to one of them.In reply to: [Resolved] Display a membership numberbp_displayed_user_id() requires an echo for display.
Just to confuse us all! 😉
In reply to: [Resolved] Display a membership numberbp_displayed_user_id()is the member’s ID so perhaps that’s the same as a membership ID? I’m not sure it matters though as the important part is it’s a unique identifier so whatever name we give it is irrelevant.You should be able to add it to your member-header.php file. Which theme are you using? Some themes might not have it so you’ll need to create it yourself if that’s the case. It might be worth reading up on the Template Hierarchy to get a feel of how BuddyPress templates work.
In reply to: [Resolved] Display a membership number<?php bp_displayed_user_id(); ?>will work on the member’s profile page.In reply to: [Resolved] Can I create a website like facebook?Hi @anivarth,
Check out BP Chat. It’s a “Facebook-like chatting plugin for BuddyPress”.
Actually it’s not quite the same. On a quick glance, I noticed you have extra
<div>tags such as<div class="effect6" style="width:100%;">, and you’re doing astr_replace()on some$_GETvariable and also you’re wrapping some of your label’s text in<h2>tags. Not entirely sure if those changes are to blame though. Anyhow, glad you got it resolved 🙂In reply to: [Resolved] Create users PagesGood point @danbp
@bloodslayer, you’d need to be logged in as ‘editor’ or upwards (admin or super admin) for my example above to work.
In reply to: [Resolved] Create users PagesHi @bloodslayer
wp_insert_post()is a function provided by WordPress which lets developers add pages to the database without the need to access the WP admin area.So, as an example, you could use it like this:
$post = array( 'post_content' => 'This is some content', 'post_name' => 'this-is-the-page-slug', 'post_title' => 'I am the title of this page', 'post_status' => 'publish', 'post_type' => 'page', 'post_excerpt' => 'This is the excerpt' ); $post_id = wp_insert_post( $post );Notes:
$post_idwill be the ID of the new page or ifwp_insert_post()failed (for whatever reason) it will be 0.So that’s how you create a new page programmatically. It’s more of a WordPress thing than a BuddyPress thing.
In reply to: [Resolved] Create users PagesIn the absence of a plugin, you would need to create a front-end form and a server-side processing script which makes use of
wp_insert_post().Ref: https://codex.wordpress.org/Function_Reference/wp_insert_post
In reply to: not recently activeHi @bea107
Did you copy and paste @danbp’s code? I haven’t tested it myself but if you have copied his code then it doesn’t look like you’ve copied it properly as some of it is certainly missing. For example, where did this bit in your code snippet come from?
add_filter( ‘bp_core_get_last_activity’ );Perhaps your own processing is the cause of the nonce not validating? We still can’t be sure the nonce is the issue here because there’s no helpful error message but it’s a good place to start looking.
I assume you’re letting BP handle the form processing in the default way and not doing your own processing?
Can you try using this and see if the problem still happens:
Hi @godavid33
It’s likely the WP nonce is invalid. Usually you get a message such as “Are you really sure you want to do this?” so I can understand why the blank page looks weird.
Have you modified the form at all? Perhaps you could paste the form’s markup into pastebin? I’ll take a look to see if I can see anything wrong
In reply to: [Resolved] Nobody visibilityVery nice plugin @shanebp!
In reply to: [Resolved] Nobody visibilityI think the field visibility settings are applicable to the member who is performing the setting.
The suggested way to do what you want would be to make your notes profile field hidden to all non-admin members.
The first step would be to create /wp-content/themes/your-theme/buddypress/members/single/profile/edit.php inside your theme.
You can copy the contents of edit.php from:
bp-templates/bp-legacy/buddypress/members/single/profile/edit.php
Then you need to modify edit.php. In edit.php, find
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>and add the following immediately after it:if ( ! current_user_can( 'manage_options' ) && ( bp_get_the_profile_field_name() === 'notes' ) ) continue;Note: I’m assuming your field name is notes
In reply to: BuddyPress notifications drop down and change notifbp_notifications_add_notification()is used to add a notification. For example:if ( bp_is_active( 'notifications' ) ) { bp_notifications_add_notification( array( 'user_id' => $user_id, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'component_name' => $component_name, 'component_action' => $component_action, 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); }See here for more info: https://codex.buddypress.org/developer/function-examples/bp_notifications_add_notification/
In reply to: not recently activeHi @bea107
Check out the Template Hierarchy article which will let you customise the BuddyPress templates.
In reply to: Limiting Membership ProfilesHi @grkmp
All activated members get allocated a URL. For example: example.com/members/username. Actually, to my knowledge, even unactivated members are given a URL so in theory any person who has completed the registration form will have a profile. They way around this would be to implement a custom registration form which doesn’t make use of the default functionality.
That won’t change what’s already been uploaded. If you upload a new avatar going forward, you should see the new size.
In reply to: Please help – Use WordPress Avatars not BuddyPress?There might actually be more things you’d need to do. For example, the
bp_get_message_thread_avatar()function usesbp_core_fetch_avatar()so you would need to filter that usingbp_get_message_thread_avataretc.Unless someone else knows of an easier way, it seems as though it’ll be a big task of going through everything. You’d also need to be comfortable with PHP.
Alternatively, you could try disabling avatars by adding this to your bp-custom.php file
define( 'BP_SHOW_AVATARS', false );Note: I’ve not tested that, I’m just going on what I see at the beginning of the
bp_core_fetch_avatar()function. i.e:// If avatars are disabled for the root site, obey that request and bail if ( ! buddypress()->avatar->show_avatars ) return;In reply to: Please help – Use WordPress Avatars not BuddyPress?If your theme doesn’t explicitly use BuddyPress templates then the default templates will be used. For a quick look at the templates check out the GitHub repo.
I’m guessing your theme doesn’t explicitly use the templates so what you’d have to do is create them yourself. The general idea is to create a folder called
buddypressinside your theme and then add the templates you’d like to customise to that folder. So for example, you’d end up with/wp-content/themes/your-theme/buddypress/. Everything goes inside there.In reply to: Please help – Use WordPress Avatars not BuddyPress?It will do, sort of indirectly, actually. For more info on how it works, check out the Template Hierarchy article.
In reply to: Please help – Use WordPress Avatars not BuddyPress?Actually scratch that last post – it’s now displaying the avatars as the WordPress avatars in the back-end but not the front end
In that case, I think we’ve just crossed that bridge hehe. i.e the next step will be to replace all instances of
bp_core_fetch_avatar()in your front-end templates withget_avatar()In reply to: Please help – Use WordPress Avatars not BuddyPress?Humm.. not helpful then. In that case we might have to try doing it manually. Perhaps try disabling the filter which replaces the WP avatars with BP avatars. For example, add this to your theme’s functions.php file:
remove_filter( 'get_avatar', 'bp_core_fetch_avatar_filter', 10, 5 );I think you can disable the Gravatar fallback as well with this:
add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );If that doesn’t work, you may need to replace all occurrences of
bp_core_fetch_avatar()withget_avatar()in your templates. But cross that bridge when you come to it.Ref: https://codex.wordpress.org/Function_Reference/get_avatar