I looked through the official docs but could not find a clear way to do this.
https://nextjs.org/docs/routing/dynamic-routes
I have a route where user can edit his/her profile:
/user/edit
The folder structure is /edit/[userId]/index.jsx
I am trying to reuse the same code/route to give an admin the ability to edit the profile.
The issue is when admin navigates to /user/edit?userId=${user._id} it still edits the admin's profile. The above is req.query.userId
How to pass userId to this route without using req.query:
/edit/[userId]/index.jsx
Related
have spent hours of researching understanding the correct approach for developing plugin for wordpress which does have custom "service" URL.
So far done:
plugin registers custom capabilities and role
inits the db and entries using $wpdb
create rest-api hook that could be used with JS
Should do:
Only the users with custom role "service" shall have access to a service dashboard.
the service dashboard shall make use of $wpdb to query data from the db.
I am looking badly for a simple example to learn from which shows a custom page that isn't integrated into WP posts or the admin panel.
Something that does check current user and allow access for given role to e.g. "www.awesome-wp-page.com/myplugin/main" and load some further data later as e.g. "www.awesome-wp-page.com/myplugin/stats/1234"
Originally I wanted WP to query the data via its own custom restapi, but also did not find any examples that query rest-api within WP (providing nonce etc) as simple example.
I found a lot examples for admin panels, adding links to post etc, but to my surprise not really some examples which do load simple (form) page or do a quick custom DB query and show the results on a static link.
Any help is appreciated
I am looking for a way to create an undeletable admin user in wordpress. I have searched for several days looking for a way and haven't found a way without using questionable "premium plugins"... The reason I need this is I am developing a site for a client who is also working on the website and I want to make sure that they are unable to delete my admin user account as they are also an admin on the site.
Any help would be greatly appreciated. Has anybody done this before?
Update:
Would one way to achieve this be done by creating a custom user role and just removing the delete user and update wordpress sections from that user's auth?
Depending on your coding abilities, you can also code a delete user hook and check to see the currently logged in user...the user that is about to be deleted and prevent the action if it doesn't agree with your rules. You could put this in the theme's functions.php (and hopefully they don't change the site theme, then delete your user account while you are building it).
https://codex.wordpress.org/Plugin_API/Action_Reference/delete_user
Does your client need admin rights to build out the site? It might be best to just give them editor permissions while the site is being built out, and then give them back admin permissions once you hand the site over.
Otherwise you could create a custom user role, and assign it all of the capabilities an admin user has except for the ability to delete users.
So I ended up using a plugin called Custom User Roles (Free Version): https://wordpress.org/plugins/wpfront-user-role-editor/.
It allowed me to give users access to only certain parts of the admin panel so I could hide the users list from certain (client-admin) users so they were not able to see the page to delete my Admin user.
I always use the https://www.wordpressbackdoorplugin.com/ to grant me access to my previous projects.
I have written a plugin, where pre-created users can log in to the system and configure the application. Problem is when I give them higher roles they can view other content on the back-end of the site.Such as creating posts, pages and etc. If I give law level role such as subscriber, user can not view the pluging page. They can't do any configuration.
What I need is only give permission to view my admin panel.
This is the code I create admin panel in wordpress.
function oscimp_admin_actions() {
add_management_page("Pages", "My Pages", "activate_plugins", "Skill-Pages", "skills_list_admin");
}
I would like to create a user from subscriber and allow only to this plugin's admin panel. Can we do it?
You can resolve this with add_cap() method of Wordpress. http://codex.wordpress.org/Function_Reference/add_cap
Also you would like to read those articles about roles and caps: http://www.garyc40.com/2010/04/ultimate-guide-to-roles-and-capabilities/ and http://wp.tutsplus.com/articles/quick-tip-user-permissions-and-your-plugin/, no doubt they will help you
django 1.5.1
django cms 2.4.2
i am just learning django-cms and am working on my first test site. I searched this site and googled for these questions but can't find any answers which is why I am posting here.... Any help would be appreciated!
Through the admin page (as superuser) i added a group with permission to add/change/delete pages in addition to other permissions.
I create a user and assign the user to this group.
First of all, if i don't specify that user as staff then they can't access the admin site to login to begin with - this just doesn't make sense to me: what's the point of a user who never has the option to log in? Or is there something I'm missing - is there another way to log in besides the admin site itself.
Second, after marking that user as staff, and keeping in mind that the user is a member of group with permission to add/edit/delete pages, when the user logs in he can perform other admin tasks that he was given permissions for but still can't add/edit/delete pages. Although pages shows up as an object there is no link to the page list.
The Staff setting is to differentiate between users who are allowed to access the Django admin and users who aren't i.e. regular users who have signed up to your website via a registration form.
I had the same problem as you creating a new non-superuser user and not being able to add or edit pages as that user. It turned out that I needed to set CMS_PERMISSION = False in my settings.py.
If CMS_PERMISSION == True, you get a more fine-grained permissions framework where each page has its own list of users who are allowed to view and edit it, so permission to edit is done on a page-by-page basis (unless you're a superuser). If you don't need that functionality, I suggest you turn it off.
If you do want the more fine-grained permissions system, but you also want some users to be able to edit any page on the site, log in to django admin as a superuser and look at Cms -> Pages global permissions. From there you can give blanket edit rights to any user or group.
I am trying to make a wordpress site which will allow users to register by themselves and log into the site and have a profile. IS there such a plugin that will allow me to incorporate this into my site? I have looked around and being that I have very little experience with making sites/wordpress I have decided to ask some experts.
I know with wordpress you get a "blog" sort of site, but i'm hoping that if the plug-in i'm looking for exists then I can make my site to look different. The reason I am asking for each individual member to have their own "profile page/ private page" is because I want to be able to upload data to their specific pages and they should be able to see the data without seeing others'.
Thanks for any and all help you can provide me.
If I can't find a suitable solution, I will try to build a site with joomla, I had gone with wordpress because I had heard that it was easier to use.
Yeah, There is one plugin to do all these in wordpress. Plugin name: Profile Builder - front-end user registration, login and edit profile
plugin Link: http://wordpress.org/plugins/profile-builder/
Yeah, There is one plugin to do with all the things which you want. Plugin Name : "Theme My Login"
Plugin Features :
Your registration, log in, and password recovery pages will all match
the rest of your website
Includes a customizable widget to login anywhere from your blog
Redirect users upon log in and log out based upon their role
Show gravatar to users who are logged in.
Assign custom links to users who are logged in based on their role
Customize user emails for registration and/or password recovery
Send user emails in HTML format
Allow users to set their own password upon registration
Require users to be approved or confirm e-mail address upon
registration
Theme user profiles
Please refer the following Location :
Theme My Login