July 30, 2015 at 4:04 pm 64386
I am trying to add an Action Hook that gets the User Role of the current logged user and displays it in a non-editable field on a profile page. My first question is where to put this code, as I am reluctant to use a child theme, seeing it messes up my Polylang translation. What's the alternative?
Furthermore, I have questions concerning the actual code of the hook. The documentation focusses on Posts, rather than users so I'm not sure how to extrapolate to User Role(s). I was thinking along the lines of, but I really need some help:
August 1, 2015 at 5:02 pm 64706
Can you please put this code in the theme’s functions.php file and see what happen then and let me know the result.
August 3, 2015 at 1:01 pm 64957
The code causes my website to stop working.
August 3, 2015 at 6:27 pm 65048
Please specify, which section create the offense on the website?
Or, is the whole site stop working?
August 3, 2015 at 6:30 pm 65052
The entire website stops working if I implement the code.
August 4, 2015 at 3:35 pm 65215
Can you please send me a screenshot.
Also, please put this code in the child theme and see what happen then and let me know the result.
August 4, 2015 at 4:22 pm 65233
It is working now that I have put it in the child theme of a test server.
However, the code doesn’t return a $value
August 4, 2015 at 5:21 pm 65246
I got it! The code I used is below:
August 4, 2015 at 5:29 pm 65247
If I upload the code from my localhost (where it is working) to the actual server. The code doesn’t work.
The thing is I can’t use a child theme because it corrupts my translation using Polylang. Therefore, I have added the code to the functions.php of my Zerif Lite theme, where it causes a server-wide crash (displays a white screen).
Is there a different way to implement this code? Maybe make a plugin that contains all my custom code?
August 4, 2015 at 5:33 pm 65249
Yes, you can create a plugin and see what happen. There might have a chance for making the things work for you.
August 4, 2015 at 5:43 pm 65251
I tried making a plugin on both my localserver and the online server. However, on the online server the plugin doesn’t show up in the Plugin list.
August 4, 2015 at 5:45 pm 65252
Uploading through a .zip gives the following WordPress error:
August 5, 2015 at 11:23 am 65358
Make sure you have properly keep the file in the zip folder. Or you can manually keep the file in the plugin folder no installation.
August 5, 2015 at 1:00 pm 65383
I tried both ways, both have failed.
If I make the plugin folder and upload the files, the plugin doesn’t appear in my Plugin list in the admin panel.
If I make a .zip and try to upload it, it gives the error stated in my previous message.
August 5, 2015 at 3:18 pm 65413
I have solved the issue. I used chown, chgrp and chmod to change the permissions of the files and directories. The action hook is now working properly AND I have a plugin that I can use to add functionality to my WordPress installation.
Thank you for all the support ;).
August 5, 2015 at 6:28 pm 65472
|towhid||This reply has been marked as private.|