- This topic has 15 replies, 2 voices, and was last updated 11 years ago by
alex1971.
-
MillaN
KeymasterSeptember 1, 2015 at 7:05 am #2523Check out the documentation, it describes all template files and they use. You need file ‘nverify-protected-access.php’, it displays the form for entering purchase code. But, do not change important, form related stuff, or the plugin will not be able to work.
-
alex1971
MemberSeptember 1, 2015 at 8:44 am #2526Hi,
I mean that on page was only the form for enter the purchase code like as “snapshot2″ [attachment file=”snapshot2.png”] and not like “snapshot1″ [attachment file=”snapshot1.png”]
Alexander
-
MillaN
KeymasterSeptember 1, 2015 at 9:25 am #2530You can’t do that because bbPress will not allow it. My plugin adds template to extend bbPress, but it is not changing the way bbPress renders page, only replaces [u]content[/u] for that page. If normal bbPress page contains sidebars and header and everything else, page that shows restricted access shows that also but replacing normal bbPress content part with restricted one, it is not part of the template my plugin can change.
-
alex1971
MemberSeptember 1, 2015 at 10:03 am #2533I understand that your plugin uses the bbpress contents template, so I gave as an example the boolean function analogy “is_user_logged_in()”
maybe like this:
if ( is_user_access_forum() ) {
echo show header content;
echo show secondary content;
echo show footer content;
} else {
echo ”;
}eg i used
if ( is_user_logged_in() ) :
do_action( ‘footer_content’ );
endif;
-
MillaN
KeymasterSeptember 1, 2015 at 10:06 am #2535You can’t do that, template my plugin overrides in bbPress can’t contain header/footer/sidebar, it is only for content.
-
alex1971
MemberSeptember 2, 2015 at 10:12 am #2541Hi,
I looked up and found in plug-in code that implements the function of what I mean, [b]function “check”[/b] in [b]”core/bbpress.php”[/b], as I understand it is implemented by means of checking [b]$user_id = get_current_user_id [];[/b] checking current user has access to the forum or not and also skips checking for administrators and moderators – I understand this correctly?
Alexander
-
MillaN
KeymasterSeptember 2, 2015 at 12:34 pm #2542Yes, but you can’t just use it anywhere. This is internal function tied into different things, and calling it from random places will not work. bbPress integration has to follow proper procedure if you want to have everything working as intended.
Milan
-
alex1971
MemberSeptember 2, 2015 at 1:12 pm #2543Why is that? For example here this works:
function is_current_user_skip_protect( $type, $forum_id = 0 ) {
global $sbv_core_bbpress;
$sbv_bbpress = new sbv_bbpress();
$user_id = get_current_user_id();
$skip = sbv_is_current_user_with_role( $sbv_bbpress->get( ‘access_unrestriced_user_roles’ ) );
$skip = apply_filters( ‘sbv_skip_protect_check_’ . $type, $skip, $user_id );
if ( ! $skip ) {
return true;
} else {
return false;
}
}and
if ( ! is_current_user_skip_protect( $user_id ) ) {
get_template_part( ‘templates/secondary/secondary’, ‘bbp’ );
} -
alex1971
MemberSeptember 2, 2015 at 1:25 pm #2544As I understand it uses envato api and checks from the forum database a users data – I think it should work anywhere! Especially I did not replace the plugin files on the other files – I just want to get through your plugin checks the current user’s access rights to the forum ( true or false ), and on this basis to exclude or include the template parts (header, sidebar, footer)
-
MillaN
KeymasterSeptember 2, 2015 at 2:42 pm #2545Again, my plugin hooks into bbPress, it can’t control how the bbPress is displaying page, it can only replace the content of the current template part. Checks and everything else are hooks into bbPress filters and actions that happen when the page is already forming, it can’t replace rendering of the whole page. My plugin offers different ways to replace elements that can be hidden, and it can’t replace theme template that forms the page (this is what you need infact). For that I would need to override the whole templates, and templates are theme dependent. My plugin works only with parts displayed by bbPress, and nothing else, everything else on the page is displayed by the theme not bbPress.
-
MillaN
KeymasterSeptember 2, 2015 at 2:58 pm #2546I can prepare a standalone function that can return true/false for a current user and a forum, but it can’t do anything else, and you would need to write your own handling to load templates and every thing else. That doesn’t exists right now, because no one asked before because it would be too much work to handle outside of the plugin, and since it will deal with theme templates I will not be able to assist in any way.
Now, I have on the list for the next version of the plugin to include such function.
-
alex1971
MemberSeptember 2, 2015 at 2:58 pm #2547Yes, and for correct work plugin I use the following construction [b]function_exists [‘is_bbpress’] && bbp_is_single_forum [][/b] and that is works only in site section where the forum is
anyway this working for me correctly
if ( ! is_current_user_skip_protect( $user_id ) ) {
get_template_part( ‘templates/secondary/secondary’, ‘bbp’ );
} -
alex1971
MemberSeptember 2, 2015 at 3:05 pm #2548I would be very grateful to you to help with such a function that checks the access rights for the user and skip user with role administrator and moderator
Thanks
-
MillaN
KeymasterSeptember 2, 2015 at 3:41 pm #2549I have this on the list for 3.1 version, that should be out in about 7-10 days.
-
alex1971
MemberSeptember 2, 2015 at 3:44 pm #2550Thanks, I’ll look forward to
- The topic ‘Function checking access’ is closed to new replies.
