Forum Replies Created
-
In reply to: Change user role based on user post count?
Thanks. Do you know how I can loop through all users in a function? I can’t seem to work it out.
In reply to: Change user role based on user post count?Potentially something like this, although it isn’t working as far as I can tell:
function bbp_change_user_role_login($user) { $user_id = get_current_user_id($user); $current_user_role = bbp_get_user_role($user_id); $new_role_forum_role="bbp_moderator"; $user_post_count = bbp_get_user_post_count( $user_id ); if (($current_user_role = "bbp_participant") and ($user_post_count > 20)) { bbp_set_user_role( $user_id, $new_forum_role ); } } add_action('wp_login', 'bbp_change_user_role_login');
In reply to: Change user role based on user post count?This seems to be a good starting point.
Ok, so whilst there doesn’t seem to be a function I can filter that based on the post count, I could potentially run a function that changes someone’s role based on their post count every time they login? That would keep database queries to a minimum and still ensure the update happens fairly regularly.
Any idea what filter or action I can use when a user logs in? Can I just use the wp_login action?
I’ve just noticed that BBP also generates a dedicated search page. Will have a dig and see how that’s done.
the topic and reply forms are at the bottom of the forum and topic pages, so there is no need to visit a separate page.
Well, yes, but it would be neat to have the option.
I already link to the bottom of the page form via the html anchor – I’ve coded that into my theme – but I’m trying to have these forms on separate pages entirely, to make the whole thing a bit neater.
Interestingly, when you click ‘edit’ on a reply it takes you to a new page where you can edit the reply. So somehow that should be possible to generate a NEW reply.
That’s exactly what I want – I WANT it to use the template files!
Whilst I can use the short code bbp-new-reply for example, it needs a topic ID to work. I simply don’t understand why BBP core doesn’t generate these pages programmatically – it makes absolutely no sense to me. You would think that would be basic functionality for a forum plugin!
Surely it can be done with a function? The plug-in must already be generating pages for the index, user profiles etc. Could creating a function create a page dynamically?
Obviously it is “just” 5 pages but for larger forums it seems a little absurd to have to create identical “new topic” pages for each one!
To add to my answer, for example BBP already appears to do this with users – ie. it creates pages based on site.com/forums/users/username
But that’s using the shortcodes and creating dedicated pages in WP right?
I want BBP to automatically generate these pages, eg. https://mywebsite.blog/forums/login
Pages required would be:
– login
– register
– password reset
– new topic
– new replyMy understanding of the shortcode is that if I wanted a new topic page, I would either have to have a generic one for the whole board or I would have to create individual ones for each forum based on the forum ID.
The solution I’m looking for is for BBP to dynamically generate them as required. Is that possible?
It seems odd to me that BBP doesn’t already do this.
EDIT: would something along these lines work? https://stackoverflow.com/questions/32314278/how-to-create-a-new-wordpress-page-programmatically
Basically, instead of having the create topic / topic reply form on the same page as the thread I want to create a button that links to a secondary page. I know this is possible with shortcodes, but is there a way of doing this without shortcodes? So that BBP auto-generates the page itself?