Forum Replies Created
-
In reply to: Blogposts not showing in activity
@arwenmckenzie glad you got it working! ๐
@rossagrant in that case it might be worth raising a WP Trac ticket as oEmbeds are handled by the WP core:
@rossagrant this could be Instagram’s server. Have you tried again recently?
In reply to: [Resolved] Timestamps in members timezoneHey @colabsadmin @shanebp @djpaul
I’m happy to help out writing the plugin. Anyone feel like taking the lead?
In reply to: Blogposts not showing in activityHave you enabled ‘site tracking’ in the WP admin settings (where you can disable and enable components)?
In reply to: [Resolved] Timestamps in members timezone@colabsadmin I really like the idea of this. It definitely beats having relative dates everywhere, which is what I did. So many BP sites out there these days with members in different time zones crying out for a plugin like this.
Looks solid to me. If you wanted to condense the code into two lines you could use the logical operator
&&e.g.
if ( bp_has_notifications( 'user_id=' . bp_loggedin_user_id() ) && is_user_logged_in() ) { // ... here I've got the loop stuff ... }You could also append this bit which will let you output something to logged in users having no notifications:
else { // ... no notifications ... }In reply to: Forums in a public/private siteHi @mauryg
Have you tried posting this in the http://bbpress.org forum? You might find your answers there.
In reply to: Orphan notifications if item was deleted.EDIT: You might want to raise this issue on Trac:
https://buddypress.trac.wordpress.org/In reply to: Error: Missing argument 2 for wpdb::prepareTake a look at this page to see the parameters accepted:
Perhaps try using
profile_group_id:By default all groups and all fields will be displayed. If you provide the ID of a profile field group, then only the fields in this group will be displayed
So it would be:
if ( bp_has_profile( 'profile_group_id=2' ) ) :Where 2 is the ID(s) of the group you’d like to include. I think it should take a comma separated list but I haven’t tested.
In reply to: returning a formatted phone number?You could try looking at https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/ to see how they do it. I think one of the profile field types is ‘number’ – so that might be the best place to start.
In reply to: is_page() does not work on BP pages@modemlooper I have a feeling that ticket will fix quite a few outstanding bugs!
In reply to: is_page() does not work on BP pagesThanks for explaining in more detail. If you feel this is a bug, you can submit a ticket on Trac
Trac is the best place to follow the development process and submit bug reports.
In reply to: is_page() does not work on BP pagesAh right, I see what you’re doing.
‘my-members’ is no longer a WP page at the moment you point your BP members directory at ‘my-members’. Is that what you’re saying is a bug?
In reply to: is_page() does not work on BP pagesJust some observations
1. ‘my members’ isn’t the same as ‘my-members’
2.<?php echo 'is_page()='.is_page().'<br>'; ?>– why are you doing this?I donโt know about you, but to me this seems like a bug in buddypress
There may well be a bug in BuddyPress – but I can’t tell that from the code and info you’ve posted.
In reply to: Error: Missing argument 2 for wpdb::prepare– Iโve turned off all PHP warnings like the first paragraph says so.
But are you a developer or a user?
With reference to any BP core changes being necessary – does the warning appear when using BP ‘out-of-the-box’ or are you introducing some code that is causing it? If it is resulting from some custom code, paste it here… and i’ll try taking a look
In reply to: Error: Missing argument 2 for wpdb::prepareTake a look at this post which will give you some background as to why WP throws that warning at you.
In reply to: Notification and a blank page@dsvay can you view your own notifications page?
Each member’s notifications page can be viewed by that member only. For example, you can’t log in as Member X and view Member H’s notifications page.
In reply to: is_page() does not work on BP pagesThe terminology is important here. WordPress ‘pages’ shouldn’t be confused with the more loosely termed web ‘page’. Although BP ‘pages’ are webpages, they aren’t WordPress pages so
is_page()isn’t going to work *most of the time*. The exception is register, activate etc.For a list of template tags you can use with BP ‘pages’ take a look at:
bp_get_profile_field_data()queries the database once, so every time you use it will result in a database query taking place. You’re right to say lots of database querying impacts performance. Performance will depend on how many queries you’re using, your hardware spec and the amount user activity your site generates.where are you planning to use the code?
Hi @macpresss
What do you mean by ‘export all profile fields by a conditional tag’?
Doing what you’ve done above is good practice because if Country is an optional field and it has not been completed by the member then nothing will be outputted:
<?php if ( $data = bp_get_profile_field_data( 'field=Country ' ) ) : ?> <!-- do something --> <?php endif ?>If you’re doing something with a single profile field then there is no need to loop through them all. It’s basically wasted effort and slower performance.
In reply to: function that breaks the BP AJAX@_dorsvenabili when adding custom functions to functions.php it might be a good idea to add a prefix to all of your function names. As you can see buddyboss has done it with
buddyboss_childtheme_.You could have used
dorsvenabili_core_get_notifications_for_userormy_core_get_notifications_for_userSaves conflicts from happening ๐
@macpresss I wouldn’t use that code from web developers wall in the members loop as it will add a database query for each member. It is more intended for use on the profile page. For the members loop, there are better ways to do it performance wise.
In reply to: Create a separate home page for logged in usersAny initial thoughts on the most optimum way to achieve this considering the reporcussions on SEO etc?
Keep in mind the search engine bot will be visiting your site as a ‘logged-out’ site visitor, so it won’t see any of the content you display to logged in users only.
One approach you could take is to have a different front page set for logged-in and logged-out visitors.
function custom_front_page() { if ( ! is_admin() ) { if ( is_user_logged_in() ) { $page = get_page_by_title( 'About' ); update_option( 'page_on_front', $page->ID ); update_option( 'show_on_front', 'page' ); } else { $page = get_page_by_title( 'Register' ); update_option( 'page_on_front', $page->ID ); update_option( 'show_on_front', 'page' ); } } } add_action( 'init', 'custom_front_page' );Where ‘About’ and ‘Register’ are the names of the pages you’d like to use as the front page.
@matt-mcfarland
cc @modemlooperI recently had to find activity item info outside the loop and came across a nifty little function
bp_activity_get_specific()which can be used like so$activity = bp_activity_get_specific( array( 'activity_ids' => $activity_id ) ); $activity = $activity['activities'][0];You can then do stuff like
echo $activity->action;which would display the text for that particular activity.One caveat is you will need to know the ID(s) of the activity item(s) you’re interested in.