Tag Info

Hot answers tagged

1

In general your problem is that you check the condition on the front end but not on the backend. You have to check if a user is a allowed to upload a file before moving it to the uploads directory and adding it as an attachment. If the limitation you put are kind of nice to have it might be enough to limit upload in the UI, but if it has business or law ...


1

This will do what you want, and both functions should be placed within your fucntions.php file. The my_random_string() function accepts arguments, so you can add data before/after the string, as well as change the length of the string and the characters that are used to generate the string. /** * Generate a string of random characters * * @param array ...


1

If I understand problem correctly, you want to store name of multiple files in user meta field. add_user_meta function has fourth argument $unique which is false by default that means for each call to add_user_meta a new key-value pair is added, even if key already exists. add_user_meta has less clarification then the add_post_meta that does exactly same ...


1

You can use get_current_user_id() - if a user is not logged in, the value will be 0: <a href="http://example.com/uid=<?php echo get_current_user_id() ?>">...</a>



Only top voted, non community-wiki answers of a minimum length are eligible