• Hi,

    I’m not sure what roles are designed to work with private pages in WP, but my private pages are not working for subscribers or contributors. Private pages work fine for Administrators, and I have not tested on Editors or Authors yet.

    I understand that private pages are not designed to work for subscribers, so I added the following to my child theme’s functions.php file:

    $subRole = get_role( 'subscriber' );
    $subRole->add_cap( 'read_private_posts' );
    $subRole->add_cap( 'read_private_pages' );

    but private pages still don’t work. Instead of seeing the private pages I just see raw code on the page, which is essentially the code for the page starting from the middle of a jQuery script in the header and finishing at the bottom of the page (for the start of the code see below).

    I’m not sure what is causing this issue, and don’t know how to troubleshoot it, and would be glad of some advice as to how to proceed.

    Thanks,

    Nick

    ");
                                        }else if(isWPHigherOrEqualThan("3.3")){
                                                        var alltext="";
                                                        alltext="";
                                                        jQuery('li#wp-admin-bar-my-account').css('cursor','default');
                                                        alltext = jQuery('li#wp-admin-bar-my-account').html();
                                                        if(alltext!=null){
                                                            var parts = alltext.split(',');
                                                            alltext = "Hello" + ", " + parts[1];
                                                        }
                                                        jQuery("li#wp-admin-bar-my-account").html(alltext);
                                        }else if(isWPHigherOrEqualThan("3.2")){
                                                        var alltext="";
                                                        alltext="";
                                                        alltext = jQuery('#user_info div.hide-if-no-js').html();
                                                        if(alltext!=null){
                                                            var parts = alltext.split(',');
                                                            alltext = "Hello" + ", " + parts[1];
                                                        }
                                                        jQuery("#user_info div.hide-if-no-js").html(alltext);
    
                                        }else{
                                                        var howdyText = jQuery("#user_info").html();
                                                        if(howdyText !=null){
                                                        jQuery("#user_info").html("<p>"+"Hello"+howdyText.substr(9));
                                                }
                                        }
                                        if(isWPHigherOrEqualThan("3.5")){
                                            //jQuery("#wp-admin-bar-my-account").css("padding-left","10px");
                                            //jQuery("#wp-admin-bar-my-account").css("padding-right","10px");
                                            //jQuery("#wp-admin-bar-my-account img").css({"margin-left":"5px","margin-bottom":"-4px"});
    
                                        }
    
                                                    }catch(ex){}
                                });
                            }
                        }
                        initJQuery();
                    </script>
                     <script type="text/javascript">
                         var agca_global_plugin_url = 'http://ainscoughassociates.co.uk/wp-content/plugins/ag-custom-admin/';                 </script>
                    <script type="text/javascript" src="http://ainscoughassociates.co.uk/wp-content/plugins/ag-custom-admin/script/ag_script.js?ver=1.2.7"></script>
    				<script type="text/javascript">
    				jQuery(document).ready(function(){
                    				});
                    </script>
                        <style type="text/css" media="print">#wpadminbar { display:none; }</style>
    <style type="text/css" media="screen">
    	html { margin-top: 28px !important; }
    	* html body { margin-top: 28px !important; }
    </style>
  • The topic ‘Private pages for subscribers and contributors not working’ is closed to new replies.