I have made a simple code that will only save to a simple database.
I have this code:

register_activation_hook(samplePath, 'sample_install');
add_action('admin_menu', 'main');
add_action('user_admin_menu', 'main');

and a function like this :

function main(){


<?php if (current_user_can('smessage')) { 
echo("admin");}
else{
if(current_user_can('rmessage')){
echo("other user");
}
}


}

and this the sample_install function from another php file :

$wpdb->query($structure);
    $a = get_role('administrator');
    $a->add_cap('smessage'); 
    $s = get_role('author');
    $s->add_cap('rmessage');

I can see the code if I login as an adminstrator but using other roles like author, subscriber, I couldn't see the plugin any more...can someone help me with this? I'm new in using wordpress...

Thank you in advance.

Have you checked user priviledges for the plugin?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.