Is the database design alright? And I’m quite lost with the admin entity here

A quick description of my system would be: there are 2 users: users and admin.

User registers on the website. Upon registration, the system will generate a QR code for the user. The user then goes to be vaccinated, and upon vaccination, someone will be able to scan his/ her QR code and the status of the user will be updated as vaccinated with the 1st dose of the vaccine. Additional information will also include, the date for the 2nd dose of vaccination, the doctor who was responsible for the vaccination, date and time of the vaccination. The user can also give his feedback for the side effects per dosage.

On the admin’s side:

  • able to log in
  • they will have a report in the graph for each of the vaccines and the percentage of how many were vaccinated with these types of vaccines.
  • graph of side effects per dosage of each of the vaccines
  • add, edit, and delete a doctor
  • add, edit, delete a vaccine
  • it will also include Analytics for the frequency of the users
  • list of those users

This is the database design I have come up so far and I’m needing help if this is correct and I’m a little lost with the admin entity here.

enter image description here

no-follow restriction removed by admin – user-generated or editorial? [closed]

On my forum website, I allow users to add their website link to their profile page. But as most forums do, I add no-follow to the link.

I am planning to implement a feature wherein I will remove the no-follow restriction based on a threshold number of helpful votes. Helpful votes are awarded by other members based on the usefulness of the interactions of a user.

Google ignores user-generated links like forum links. But in my case, since I am removing the no-follow restriction, will the link be treated like an editorial one? Or will Google still treat the same as user-generated one? (as users created them in the first place.)

Dequeue Gutenburg Block Library CSS (‘wp-block-library’) in Admin

I am working on removing the default Gutenberg block library stylesheet and replacing it with custom pared-down styles. I do not want the original stylesheet to load on either the front or back end, as it means I’d need to add unnecessary bulk to the custom styles in order to override styles in the default stylesheet.

I’ve successfully dequeued the styles from the front end using the standard in a wp_enqueue_scripts action:

function test_function(){     wp_dequeue_style('wp-block-library'); } add_action( 'wp_enqueue_scripts', 'test_function' ); 

However, this does not dequeue the styles from the block editor. I have tried dequeuing from an admin_init action as well, and that also does not remove the styles from the block editor.

Is it possible to dequeue this stylesheet from both the front-end and the admin block editor?

How to show the posts listing on dashboard or custom page in admin panel?

I want to show posts listing(almost like the default post listing page) on the dashboard page. And if that is not possible then maybe on a new page in the admin area.

Basically, I want to create a "My Desk" page for users where they can see some posts listed categorised by post meta. I’m fairly new to WordPress and can’t get an idea as to how this can be achieved.

Any help is appreciated, thank you!

Hide Custom Taxonomy Editor for Specific Role(s) in WP Admin

I know you can select whether to hide or show various aspects of the custom taxonomy editor by passing arguments to the show_ui, meta_box_cb, or show_admin_column fields when registering. Something like:

register_taxonomy(     '',  //NAME OF CATEGORY     '', // NAME OF CUSTOM POST TYPE     array(         'show_ui' => true,         'meta_box_cb' => false,         'show_admin_column' => true     ) ); 

What I am wondering is how can I add a hook/filter beyond this so I check for the role of the current user and then set whether those arguments are true/false depending on the role?

I am here, but stuck:

add_action('in_admin_header', 'restrictTaxonomyEditBy'); function restrictTaxonomyEditBy() {     $  screen = get_current_screen();     $  user = get_current_user_id();     global $  post;         if(!current_user_can('administrator')) {         //ADJUST TAXONOMY PROPERTIES HERE TO HIDE/SHOW ADMIN UI     } } 

Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”

All of a sudden we are not able to get to the admin panel of the website. Once I log into /wp-login.php it redirects me to the homepage or /wp-admin (depending on whether I visited wp-admin in logged out state or not)

WordPress version: 5.6.2

When it does redirect to /wp-admin I see:

"Sorry, you are not allowed to access this page."

My first guess was that someone (maybe another user with administrator access) changed the roles. That wasn’t the case, I confirmed by looking at the database tables and the users had the wp_capabilities that corresponded to being an admin.

Then I tried a bunch of other stuffs and none worked:

  1. Created a new user using wp_create_user, added administrator capabilities, logged into that account from a private browsing window. Same.

  2. Went to the WordPress git repo searched for where "Sorry, you are not allowed to access this page." appeared, it did at many places so I added random string of text in some files to see exactly which one, it came from the file wp-admin/includes/menu.php in the last lines:

    if ( ! user_can_access_admin_page() ) {

  3. I thought maybe user_can_access_admin_page() returned wrong information for some reason, so I used a page template to output some data like so

if ( current_user_can('administrator') ) {     echo "Yes, admin"; }  if ( user_can_access_admin_page() ) {     echo "Can access admin"; } else {     echo "Can't access admin"; } 

Both returned true, yet the check on menu.php fails. Not sure why.

  1. Replaced wp-admin and wp-includes folder with fresh copies downloaded from WordPress org.

  2. Renamed the theme and plugin folders to rule out the problem coming from a plugin or theme. Not the case, it still was the same.

  3. Checked the error log of Apache2 as well as enabled debugging log for WP to look for any related error, none found. Nothing special, all the usual PHP notices that I have seen before.

  4. At one point I noticed the SSL certificate expired a month ago (problem started yesterday though) so just to be sure I renewed that as well, still the same.

Anybody who have an idea on what might be wrong would be a great help!

Redirect users from admin pages the optimal solution

On two different sites I use two somewhat different solutions. Are they different in terms of security and performance? Which is better? Are there even better ones?

Solution 1.

/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! current_user_can( 'manage_options' ) && ( ! wp_doing_ajax() ) ) {         wp_safe_redirect( site_url() );         exit;     } } ); 

Solution 2.

/** Redirect users from admin pages if not administrators **/ add_action( 'admin_init', function() {     if( ! in_array( 'administrator', wp_get_current_user()->roles ) ) {         wp_redirect( get_bloginfo( 'wpurl' ) );         exit;     } } ); 

How to break line / add to ADMIN menu

Disclaimer: This question is not about "frontend" nav menu

I am looking for a way how to break line in a menu item label in WP admin sidebar menu, sidereason is that the custom post type label I am registering is too long for 1 line and I don’t really want to mess with the width of the admin menu.

I tried adding both "\n" and <br> into the custom post type label, but <br> gets escaped and line breaks are not converted.

I tried to look on the Internet, but I mainly found articles how to line break in "frontend" menu items which is not what I am looking for.

Is there some sort of filter or other way to do this?

Note: I would also like to avoid tinkering with anything global or special characters like nonbreaking hyphen, if possible
Note2: I know there is auto linebreak in place, however I need a manually added line break because the term is in some-thing format so it breaks on dash which is unwanted behavior