WordPress.org

Ready to get started?Download WordPress

Forums

Automatic delete post in P2 theme (2 posts)

  1. chuyenly
    Member
    Posted 8 months ago #

    Hi,
    How can I set my site to automatic delete post from member after a period of time and enable members to do so such as: disable the delete function or set the time.
    Do you have any suggestion?
    Thanks for your helps.

  2. bcworkz
    Member
    Posted 7 months ago #

    A scheduled event could take care of deleting posts of certain users older than a certain time period. You of course need to store this data somewhere, usermeta is one such place. The lack of such meta data or a 0 value could indicate to your scheduled delete old post function to not delete anything.

    You can add this time setting to the user profile page using the 'personal_options' action, which fires after the last table row before the table close tag is output, so your code should echo a table row and table cells to contain your form fields. Match the class of other table content to obtain the same styling.

    Save the value to usermeta from the contents of $_POST by hooking the action 'profile_update'.

Reply

You must log in to post.

About this Topic

Tags