Buddypress Xprofile fields & Wordpress custom user meta 2 way sync - php

I am working a wordpress + buddypress based eCommerce site which has marketpress plugin installed to handle the ecommerce part. The problem i am running into is that both wordpress usermeta and buddypress x-profile fields are not integrated with each other by design.
Within my current setup, users can register using buddypress sign-up and fill in their profile information and edit it as well.
I am trying to get the buddypress profile information to be in sync with Wordpress custom usermeta fields i created so that the buddypress profile information can be used within plugins like marketpress (which relies on wordpress user meta to populate shipping fields for a logged in user). Are there any buddypress & wordpress hooks which can be used here to setup a two way sync between buddypress xprofile and wordpresss user meta fields?

In the Dashboard under 'Settings > BuddyPress > Profile Settings' have you selected "Enable BuddyPress to WordPress profile syncing" ?
I think that it only syncs full names and email addresses.
The available syncing functions are found in
buddypress\bp-xprofile\bp-xprofile-functions.php
function xprofile_sync_wp_profile()
function xprofile_sync_bp_profile()
Perhaps the hooks used there will help you write a function to push BP profile fields to usermeta. But it might be easier to change MarketPress to pull from BP rather than WP.

Related

Custom WordPress Plugin - Create A FE Page

I am trying to create a custom plugin that adds a frontend page to the site. I have figured out how to have WordPress create the pages to the DB when the plugin is activated, but that gives the user the ability to delete them so I would like to create them sort of like adding a static page in the theme, but within a plugin.
I have found this article that shows how to use parameters to display a page, but I would rather have it be a specific slug, not a parameter: https://opensynergic.com/make-custom-plugin-front-end-page-in-wordpress/
Any assistance or direction would be amazing!
Thanks!

Customizing wordpress navigation header with woocommerce my account

I am new to wordpress and I was creating a eCommerce website with woocommerce, then I have an idea to make an custom navigation header where when user is not log in it will show login/register and when login it will show to name of the customer.
There are a few ways you can achieve this.
The easiest option is to use any one of the below plugins. Using these plugins, you can show/hide menu items based on their login status. These plugins also allow you to customize the menu based on User roles as well.
https://wordpress.org/plugins/nav-menu-roles/
https://wordpress.org/plugins/user-menus/
Or you can assign a custom class to the menu item and then you can hide/show them using CSS. "logged-in" class is added to the BODY tag when a user is logged in.

Custom Wordpress Dashboard for custom user role without a plugin

I am creating a page where a certain type of user upon login should only be able to see my plugin dashboard (or a custom php file), without the WordPress dashboard. Is there a way to do this without an extra plugin?
I am currently using Advanced Access Manager as a way of restricting that given user type of accessing anything else in the dashboard.
I would like to get to a similar result if possible hide every Wordpress-like element or style it to my own design. And I would like to achieve it without using an external plugin or editing the functions.php
You can do custom page template, check if user legged in and then present functionality, then users with subscriber role can access the page because they are singed in. do custom login form and after successful login redirect to that custom page.

In wordpress, is there a way to add posts as drafts from the main site, not the admin panel?

Have to make something so anybody can add something in the form on the public site, then admin in admin panel will publish it. The post will be a custom type with custom fields and post thumbnail.
So like in a title. Is there a way to make it happen in WordPress?
Found function *wp_insert_post* but how to make it work for nonregistered users, also how to upload a picture and add it to post?
Ok, I found the way to do that.
Simply use 'Contact Form 7' and plugin 'Post My CF7 Form', create frontend form in CF7 and map it to custom post type. Needed to do some changes in code but works like charm.
For this, I would recommend a plugin called Formidable Pro. With formidable pro, you have the ability to put a front-end form on a website that allows users (logged in or not, depending on how it's setup) to create posts with form submissions.
In the form, you would add fields for all relevant parts of the post (custom fields, title, picture upload, body copy, etc...) then in the settings of the "make post" function in Formidable Pro, attach all the relevant fields to the post content areas (featured image, title, custom fields, etc...).
Formidable Pro can be purchased and downloaded via formidablepro.com (unfortunately the create post feature is a paid-only feature).
Here is their help desk article on creating posts from entries: https://formidableforms.com/knowledgebase/create-posts/

How to add WordPress custom posts by front end forms

I have created a custom post type named gallery and its showing up nicely and works fine for me. My problem is that I don't want to allow my users to post their galleries from dashboard I want a way so that they can post there gallery images from front end by using upload buttons or any thing like forms etc. Is this possible to achieve in WordPress?
Kindly guide me in this regard, or is there any plugin which can do this task for me?
You can set and retrieve custom fields in code, either using custom metaboxes or a plugin like Advanced Custom Fields or Pods
You can set capabilities when you register a post type to control what roles can access what.

Categories