• Hi,

    How to make function (argumen would be $userid), that would change user role only for this user.

    I would like to implement that in functions.php file.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Why are you doing it in the functions, and to what purpose?

    Thread Starter testna

    (@testna)

    I wanted that someone would get admin rights, after filling up user details in profile (name, phone number…). Before that he wouldn’t have rights to add or edit pages and everything

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    That would be a big security risk, since a spammer would be able to fill in the data with junk and then have admin rights.

    And you wouldn’t want to do it in the functions.php file anyway, because that’s *theme* based, when what you want is user based.

    Thread Starter testna

    (@testna)

    I know it is theme based.

    How can I solve that diferently?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Make a plugin that, when someone logs in, checks for completion of the profile. If found, promote user levels.

    And I wouldn’t do it in a million years, if you paid me.

    Take the code you were going to put in functions.php and put it in a separate php file with a plugin header. then activate it as a plugin.

    or put it in the mu-plugins folder.

    And make sure you’re doing a check for a specific user.

    The whole of wordpress is filled with functions. you are not require to stick them in functions.php.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change user role of one user in functions.php’ is closed to new replies.