• steigerdaniel

    (@steigerdaniel)


    Hi guys,
    So I have now used more than 5 hours with trying and googling, I now try and hopefully get some help from here ??

    I have created a new WordPress page and now switched it to SSL.
    What I basically did was following

    – Changed the WP_HOME and WP_SITEURL to the HTTPS URL
    – Changed those entries as well in the DB
    – added following to the .htaccess:

    <IfModule mod_headers.c>
    #Umleitung http zu https
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>

    It then looked like everything worked, however i was not able to log in to my admin panel anymore because of “you do not have sufficient permissions to access this page”

    So I checked all those prefixes in the DB since most of the online forms suggested that. -> Was okay. (wp_capabilities, wp_user_level etc.) Entry in the wp_capabilities is a:1:{s:13:”administrator”;b:1;}

    I renamed the Plugins folder -> didn’t help.

    I then added in my functions.php following code:

    function codelight_all_permissions( $allcaps, $cap, $args ) {
        $allcaps[$cap[0]] = true;
        return $allcaps;
    }
    add_filter( 'user_has_cap', 'codelight_all_permissions', 0, 3 );

    Funny enough, I was then able to log in to my backend. However, I’m not able to do basically anything with that function in my code. (for example edit or delete pages or posts)

    I also added a new user and gave admin rights to him, but still same result. I’m totally out of ideas, any helps would be super appreciated!

    What little bit irritates me as well, is that when I press mypage.com/wp-admin I get redirected to /wp-login.php?redirect_to=https%3A%2F%2Fwww.mysite.com%2Fwp-admin%2F&reauth=1
    not sure however, if that is correct or incorrect.

    the wp_user_role in wp_options has following entry:
    a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:30:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:19:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:8:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:4:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Alan Fuller

    (@alanfuller)

    How did you do this step?

    – Changed those entries as well in the DB

    Thread Starter steigerdaniel

    (@steigerdaniel)

    I did an Update on the option_name siteurl and home to the SSL URL

    Thread Starter steigerdaniel

    (@steigerdaniel)

    @alanfuller (Didn’t know you can acctually tag people in the comments ;))
    I backed up my page (from FTP and the whole DB as well), deleted both and reinstalled WordPress. After the installation I get to the Login and it says immediately “you do not have sufficient permissions to access this page”.

    Now I am not quite sure whether that makes an impact or not, but in the phpmyadmin I discovered few issues as well.
    My PHP-Version is 7.2.24 (according to WP it’s supposed to be 7.4. for the most recent WP-installation).
    As soon as i log into phpmyadmin I get an OpenSSL error: error:0909006C:PEM routines:get_name:no start line error. Now since I dont admin the DB part I asked the admin to update the phpmyadmin from version 4.6.6 to 4.9.1, which I found on stackoverflow and to double check the correct cert file, which i found here.

    Conclusion: Not sure if any of this helps, however I keep you posted ??

    Alan Fuller

    (@alanfuller)

    You can tag people, but it actually doesn’t do anything, either people are subscribe to a thread or not.

    In some ways it is a bad idea, as it may put other respondents off thinking that the issue is in the hands of someone.

    I can say that PHP version alone is not the issue although WP says 7.4 it runs on 5.6 to 8.0.

    Beyond that I’m not sure where your issue lies, perhaps some others can pitch in.

    Thread Starter steigerdaniel

    (@steigerdaniel)

    I see your points and I do agree.
    I am acctually also agreeing with you, that I don’t really think, upgrading the PHP version is going to solve my problem, however I don’t really see a reason why not upgrading it, since a) wordpress does require it and b) I then can be certrain, it wasn’t caused by that.
    Nonetheless I would be surprised if it is not going to be an issue with the DB (or a value set within the DB), since the code mentioned in the first comment

    function codelight_all_permissions( $allcaps, $cap, $args ) {
        $allcaps[$cap[0]] = true;
        return $allcaps;
    }
    add_filter( 'user_has_cap', 'codelight_all_permissions', 0, 3 );

    lets me log in to the admin area of wordpress…
    Plus, this all started after I switched to HTTPS. Then having an SSL error on my phpmyadmin does seem a bit suspicious to me.

    Alan Fuller

    (@alanfuller)

    My original question was related to how you changed the entries in the DB

    This is often an area of problem, as entries are stored in serialised data by plugins / themes etc in places you can find or change easily

    If I ever migrate from http to https I do a whole database search/replace of https://old to https://new

    My preference is to to use WP CLI
    e.g.

    wp search-replace --all-tables --precise "https://domain" "https://domain"
    wp search-replace --all-tables --precise "https://www.domain" "https://domain"

    See also https://www.ads-software.com/support/article/moving-wordpress/#changing-your-domain-name-and-urls

    Thread Starter steigerdaniel

    (@steigerdaniel)

    Since there is nothing that annoys me more than this kind of discussions without conclusion:

    I once again re-installed wordpress and made it step by step.
    So the issue in the end was this little piece

    if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
       $_SERVER['HTTPS']='on';
    else
       $_SERVER['HTTPS']='off';

    I added this one in my wp-config.php file, since I got an redirect error.
    After I added this one I was able to access my homepage, however again I got the “you do not have sufficient permissions to access this page” message again. The resolution is as simple as it can be:

    IT HAS TO BE ADDED AT THE REALLY BEGINNING OF THE wp-config.php. Hope I this helps others as well.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Not sufficient permissions’ is closed to new replies.