Search Results for 'code'
-
Search Results
-
Hi,
Here’s my situation. I have a site with several forums. Let’s call them Forum A, B and C. All users to the site can view Forum A. Through other actions that happen on the site users collect points. At a certain point total Forum B becomes available. At another point total Forum C becomes available. There is an external webservice I can call to see if the user has the appropriate number of points for the relevant Forum.
As far as I can tell, bbPress doesn’t have the built in capability to handle that particular permissions scenario so I’m building a plugin. My plugin is hooking on the “user_has_cap” filter to determine whether a user can see a particular forum. I don’t want to make an external webservice call on every single current_user_can() call that gets made during a page load, so in my hook function I want to immediately check to see if the current request is a Forum page.
For example, if the requested page was “http://localhost/wordpress/forums/forum/forum-b/” then being able to get the pagename “forums” it would allow me to jump out of my hook function immediately if the request wasn’t for a forum page or topic. Below is a copy of code/pseudocode for what I’m doing in the plugin.
function forum_lock_check($allcaps, $cap) { if (pagename != "forums") return $allcaps; if (webservice says I can) { $allcaps["can-view-forum"] = true; } return $allcaps; } add_filter("user_has_cap", "forum_lock_check", 10, 3);Is there a wordpress or bbpress function that gives me the pagename the forum is attached to? Of course, if there is an easier way to do what I want, I’m all ears for that as well. Thanks for any help you can give me.
Topic: Redirect User Profile Link
Hello,
I have looked everywhere and could not find an answer.
I found other things like putting the link in a menu item.
But, what I wanna do is redirect the user profile page. I do not want to use bbPress´.
So, to be specific. I am using UPME, a premium wordpress theme from Codecanyon.
And the profile link for this plugin (User Profiles Made Easy) is:
http://codeboy.co/profile/username
So I want to get rid of the bbPress user profile that appears in the forums and when a user creates a debate/post it will automatically link there, link:
http://codeboy.co/forums/users/Codeboy/
I want it to link here instead:
http://codeboy.co/profile/username
So from plain view it looks like I would just need to change this link in some php file of bbPress, yet I have not had any luck after many hours of headaches.
Could somebody please help me?
Thanks!
Hi all,
I have a function tied to the filter bbp_theme_before_reply_form_submit_wrapper and I noticed that this function was called twice every time I refreshed the topic page. This happens only when pretty permalinks are on (/%postname%/) and only on FireFox.
After investigating bbpress and WordPress source code I found out that the template_include filter (found in wp-includes/template-loader.php) is applied twice.
It only happens on bbpress pages, only on FireFox, only with pretty permalinks on.
I’m using WordPress 3.8 and bbpress 2.5.3
I’m using a custom theme but I already tested on TwentyThirteen and I experience the same problem.
Any help would be appreciated!!!
Thanks!!