In the absence of a plugin, you would need to create a front-end form and a server-side processing script which makes use of wp_insert_post()
.
Ref: https://codex.wordpress.org/Function_Reference/wp_insert_post
Tks for bou reply but I cant understand where wp_insert_post()
is help me. Could you be more specific please? How may I doing this with this code to create a function to create a menu in user profiles to open creation of pages and users like that pages?
Thanks
Hi @bloodslayer
wp_insert_post()
is a function provided by WordPress which lets developers add pages to the database without the need to access the WP admin area.
So, as an example, you could use it like this:
$post = array(
'post_content' => 'This is some content',
'post_name' => 'this-is-the-page-slug',
'post_title' => 'I am the title of this page',
'post_status' => 'publish',
'post_type' => 'page',
'post_excerpt' => 'This is the excerpt'
);
$post_id = wp_insert_post( $post );
Notes: $post_id
will be the ID of the new page or if wp_insert_post()
failed (for whatever reason) it will be 0.
So that’s how you create a new page programmatically. It’s more of a WordPress thing than a BuddyPress thing.
@bloodslayer,
by default, WP users cannot publish pages, but only post.
See here for roles and capabilities.
A Premium plugin exist who let you do this, FormidablePro, also avaible in a free version. More here.
And to add a FB like button, search on the plugin repo.
Good point @danbp
@bloodslayer, you’d need to be logged in as ‘editor’ or upwards (admin or super admin) for my example above to work.
My time is short to do this and publish. I think its possible to duplicate groups? if this is possible my problem is solved because i will have groups and another tab can be used by pages.
Is that possible?