WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Use plugin as user that has NOT id=1

[Resolved] Use plugin as user that has NOT id=1

Viewing 14 replies - 1 through 14 (of 14 total)
  • You can setup the plugin for another WordPress user (it is a multi user plugin), but it is not possible to change a user ID.
    See the FAQ if you had enabled ‘Share with all users’.

    Electrosmog
    Participant

    @electrosmog

    Sorry but of course it is possible to change the user ID of an existing user. You can change it in the SQL database of WP – and there are even security plugins which are able to change it via the admin backend. The problem is that many hackers try to hack admin accounts, and by default the id #1 is the very first user account: the admin account.

    So I think it would make sense to be able to allow certain users to be able to change the settings.

    Norbert
    Member

    @norbusan

    I agree here.
    I also don’t have a user with id=1, and as a consequence I cannot configure the plugin, thus it is broken.
    The plugin should check whether the currently logged in user is administrator, and be content. That is the only requirement.

    Can you please implement this

    Thanks a lot

    Norbert

    Electrosmog
    Participant

    @electrosmog

    Well, I needed to create a new user, needed to give it id=1 via SQL, then needed to give him admin status via admin platform of my non-#1-ed account, then needed to reset the newly-created password, then needed to log in with that account, then needed to reinstall the plugin and of course re-authorize and reconfigure it, and after this I had the settings that I wanted. Then I could delete the #1 admin again (or degrade its rank to subscriber or author or s). But this can’t be a way that makes sense.

    As Norbert says: Please implement that users which can alter settings can at least be specified.

    Thanks in advance.

    This plugin works with any users name and the user ID doesn’t matter, even the permissions do not matter (although the admin can do some things more).

    If you change the user ID in the database manually, then it won’t work, but how coulld it?
    If you manipulate the database yourself, you will have to manipulate the records of the plugin too.

    The same applies if you delete a user. If you deleted the admin user that enabled ‘Share with all users’ option, there is a solution for that in the FAQ.

    Again, this plugin works with any user name and any user ID as long as you use WordPress to manage users.

    For your next support question or follow up on this one, please go here:

    forum.faircode.eu

    Norbert
    Member

    @norbusan

    Hi Marcel,

    yes, once the plugin is configured, then it works with any user id.

    But you missed that for *configuration* you need to have id=1, otherwise you get a warning and cannot configure.

    That is all we asked, that *configuration* can be done by any admin user instead of only id=1.

    Norbert

    There is no check in the plugin for user ID 1.
    Where did you get that warning/error?
    What was the exact text?
    Are you sure Add Link to Facebook issued the warning?

    Norbert
    Member

    @norbusan

    I retried, it is repeatable:
    * activate plugin
    * go to Tools -> Add Link to Facebook
    What I get is in the right two boxes, one contains:

    Add Link to Facebook needs configuration

    and one contains

    Only this user can access the settings: (id=1)

    Looking at the source of the page I see:
    <div id="message" class="error fade al2fb_error"><p>Only this user can access the settings: (id=1)</p></div>
    so I guess that it is generated by your plugin, as there is the al2fb_error.

    Does this make the thing clearer?

    Norbert

    The user ID is not hardcoded, it could also be user ID 2, 3 or whatever.
    The message will appear only if you have configured the plugin before with the user ID stated in the message and checked the option ‘Share with all users’ from this user.

    This message will never appear if you didn’t configure the plugin before.

    What I wrote before is still valid: if you manipulate the database yourself or delete a user you have configure the plugin with, you will need the change the records of the plugin too (user meta data).

    See the FAQ if you want to uncheck the ‘Share with all users’ option when you have no access to the user that checked the option anymore.

    One last remark: I see no way to fix this. If the user is gone, there is no reliable way to choose a new user that should have the ‘Share with all users’ option (and all other configuration and authorization data). This could even be a privacy violation, since the deleted user did setup the plugin with his/her Facebook account and the new user could be another person with another Facebook account.

    Before you ask: admin users could be different persons with different Facebook accounts too, that is why only one admin user has access to the ‘Share with all users’ option and why this message exists: to remind which user. If the user was not deleted, not only the user ID would be shown, but also the account name.

    Norbert
    Member

    @norbusan

    Hi Marcel,

    wow, thanks a lot for the detailed explanation, yes, now I see your point, and I agree that this cannot be changed.

    But to make things better, maybe it is worth to provide a better warning message, something like

    The following user has been configured this plugin and selected “Share with all users”, only this user can change settings. UID

    Thanks for your detailed analysis and explanation, it is clearer now.

    Norbert

    feelinfae
    Member

    @feelinfae

    I followed the instructions via the FAQ’s because I have this issue as well and now my site is broken.

    I put the same page back to how it was prior to me adding the code provided and I still get the error.

    Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in /sitefolder/wp-content/plugins/add-link-to-facebook/add-link-to-facebook-class.php on line 2753

    Also it says that file is inactive

    Update: I re-uploaded the page via FTP and it fixed the issue. I then made changes to the page manually (not within my WP site) then uploaded the modified page via FTP and it worked. Initially I did it via the WP editor. So not sure why that didn’t work vs. a manual override. FYI in case anyone else runs into that issue.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] Use plugin as user that has NOT id=1’ is closed to new replies.