1. Home
  2. ReHub Theme
  3. Cashback Functions
  4. How to add form for cashback request

How to add form for cashback request

In previous steps we added notices, tracking subid, point system. Now, it’s time to add contact form for users where they can submit their refund request.

As on previous step, we will add this form inside User Profile.

For this, we have special place in theme. You can find it in  theme option – Buddypress – Add custom message or html in profile of User  Everything which you add in this place will be rendered in User Profile page inside Profile tab. Make sure that Profile tab is the first tab of profile. It will be the second tab if you enabled Activity for Profiles. You can disable activity module in Settings – Buddypress.

You can also add this code in widget instead of profile description. Widget is visible on all Profile pages. For this, go to Appearance – widgets and add code to Custom HTML widget in Buddypress Profile Sidebar area.

Of course, you can use our magic shortcode and show private data for user. For this, use

[rh_is_bpmember_profile]
Private content here
[/rh_is_bpmember_profile]

Inside private content, we will add special contact form. Most easy way to build it – plugin Contact Form 7

Install this plugin and Create contact form. Copy shortcode of form.

Contact form has great feature – mailtags. You can place it in content of form. For example, you can place [_user_login]

and User login will be generated in email, so, you can know who is contacting you.

Now, you can wrap it with our special Button popup shortcode.

[wpsm_button_popup btn_text="Request cashback"][contact-form-7 id=8][/wpsm_button_popup]

It’s also, better to show how much cashback user has. This can be done via special shortcode

[rh_get_profile_data userid=current pointmeta=approved_cashback]

where approved_cashback is point key where we store our cashback points

Now, if we mix all together and add some styles, we can get next code.

[rh_is_bpmember_profile]
<div class="border-lightgrey-double padd20">
You have [rh_get_profile_data userid="current" pointmeta="approved_cashback"] points.
<div class="mb10"></div>
[wpsm_button_popup btn_text="Request cashback"]
[contact-form-7 id=8]
[/wpsm_button_popup]
</div>
[/rh_is_bpmember_profile]

You can also add background for block, code will be next in this case

[rh_is_bpmember_profile]
<div class="rehub-main-color-bg padd20">
<div class="whitecolor mb10">You have [rh_get_profile_data userid="current" pointmeta="approved_cashback"] points.</div>
[wpsm_button_popup btn_text="Request cashback"]
[contact-form-7 id=8]
[/wpsm_button_popup]
</div>
[/rh_is_bpmember_profile]

Of course, don’t forget to change contact-form-7 ID in code to your own id of contact form