biodun09
Forum Replies Created
-
Forum: Plugins
In reply to: [WPGraphQL] Custom post type not adding custom fieldthe REST API was part of my troubleshooting process. i tried commenting out the two lines but the menus stopped showing and querry returned empty array [] still.
it’s a custom plug-in. Is there anyway I can share the plug-in so you can take a look. Thanks in advance
- This reply was modified 9 months, 1 week ago by biodun09.
Forum: Plugins
In reply to: [WPGraphQL] Custom post type not adding custom fieldTHis is the entire code on the page. i really cant see why i cant access the data. i changed apply-filters to add-filters but it causing errors, i’m stuck at this point.
<?php
/**
- Custom Post Type.
*/
if ( ! defined( ‘ABSPATH’ ) ) {
exit ; // Exit if accessed directly.
}
if ( ! class_exists( ‘HRW_Register_Post_Types’ ) ) {
/** * HRW_Register_Post_Types Class. */ class HRW_Register_Post_Types { /* * Wallet Post Type */ const WALLET_POSTTYPE = 'hrw_wallet' ; /* * Transaction Log Post Type */ const TRANSACTION_LOG_POSTTYPE = 'hrw_transactions_log' ; /** * HRW_Register_Post_Types Class initialization. */ public static function init() { add_action( 'init' , array( __CLASS__ , 'register_custom_post_types' ) ) ; } /* * Register Custom Post types */ public static function register_custom_post_types() { if ( ! is_blog_installed() ) return ; $custom_post_types = array( self::WALLET_POSTTYPE => array( 'HRW_Register_Post_Types' , 'wallet_post_type_args' ) , self::TRANSACTION_LOG_POSTTYPE => array( 'HRW_Register_Post_Types' , 'transaction_log_post_type_args' ) , ) ; $custom_post_types = apply_filters( 'hrw_add_custom_post_types' , $custom_post_types ) ; // return if no post type to register if ( ! hrw_check_is_array( $custom_post_types ) ) return ; foreach ( $custom_post_types as $post_type => $args_function ) { $args = array() ; if ( $args_function ) $args = call_user_func_array( $args_function , $args ) ; //Register custom post type register_post_type( $post_type , $args ) ; } } /* * Prepare Wallet Post type arguments */ public static function wallet_post_type_args() { return apply_filters( 'hrw_wallet_post_type_args' , array( 'labels' => array( 'name' => esc_html__( 'All Wallet' , HRW_LOCALE ) , 'singular_name' => esc_html__( 'All Wallet' , HRW_LOCALE ) , 'all_items' => esc_html__( 'All Wallet' , HRW_LOCALE ) , 'menu_name' => esc_html_x( 'All Wallet' , 'Admin menu name' , HRW_LOCALE ) , 'add_new' => esc_html__( 'Add Wallet' , HRW_LOCALE ) , 'add_new_item' => esc_html__( 'Add New Wallet' , HRW_LOCALE ) , 'edit' => esc_html__( 'Edit' , HRW_LOCALE ) , 'edit_item' => esc_html__( 'Edit Wallet' , HRW_LOCALE ) , 'new_item' => esc_html__( 'New Wallet' , HRW_LOCALE ) , 'view' => esc_html__( 'View Wallet' , HRW_LOCALE ) , 'view_item' => esc_html__( 'View Wallet' , HRW_LOCALE ) , 'view_items' => esc_html__( 'View Wallet' , HRW_LOCALE ) , 'search_items' => esc_html__( 'Search Users' , HRW_LOCALE ) , ) , 'description' => esc_html__( 'Here you can able to see list of Wallet' , HRW_LOCALE ) , 'public' => true , 'show_ui' => true , 'capability_type' => 'post' , 'publicly_queryable' => true , 'exclude_from_search' => false , 'hierarchical' => false , // Hierarchical causes memory issues - WP loads all records! 'show_in_nav_menus' => true , 'show_in_menu' => 'hrw_wallet' , 'menu_icon' => HRW_PLUGIN_URL . '/assets/images/dash-icon.png' , 'supports' => array('title', 'editor','custom-fields'), 'show_in_rest' => true, 'show_in_graphql' => true, 'graphql_single_name' => 'hrwwallett', 'graphql_plural_name' => 'hrwwalletts', 'query_var' => true , 'map_meta_cap' => true , // 'rewrite' => false , 'capabilities' => array( 'create_posts' => 'do_not_allow' , ) ) ) ; } /* * Prepare Transaction Log Post type arguments */ public static function transaction_log_post_type_args() { return apply_filters( 'hrw_transaction_log_post_type_args' , array( 'labels' => array( 'name' => esc_html__( 'Transaction Log' , HRW_LOCALE ) , 'singular_name' => esc_html__( 'Transaction Log' , HRW_LOCALE ) , 'all_items' => esc_html__( 'Transaction Log' , HRW_LOCALE ) , 'menu_name' => esc_html_x( 'Transaction Log' , 'Admin menu name' , HRW_LOCALE ) , 'add_new' => esc_html__( 'Add Transaction Log' , HRW_LOCALE ) , 'add_new_item' => esc_html__( 'Add New Transaction Log' , HRW_LOCALE ) , 'edit' => esc_html__( 'Edit' , HRW_LOCALE ) , 'edit_item' => esc_html__( 'Edit Transaction Log' , HRW_LOCALE ) , 'new_item' => esc_html__( 'New Transaction Log' , HRW_LOCALE ) , 'view' => esc_html__( 'View Transaction Log' , HRW_LOCALE ) , 'view_item' => esc_html__( 'View Transaction Log' , HRW_LOCALE ) , 'view_items' => esc_html__( 'View Transaction Log' , HRW_LOCALE ) , 'search_items' => esc_html__( 'Search Users' , HRW_LOCALE ) , 'not_found' => esc_html__( 'No Transaction Log found' , HRW_LOCALE ) , 'not_found_in_trash' => esc_html__( 'No Transaction Log found in trash' , HRW_LOCALE ) , ) , 'description' => esc_html__( 'Here you can able to see list of Transaction Log' , HRW_LOCALE ) , 'public' => true , 'show_ui' => true , 'capability_type' => 'post' , 'publicly_queryable' => true , 'exclude_from_search' => false , 'hierarchical' => false , // Hierarchical causes memory issues - WP loads all records! 'show_in_nav_menus' => false , 'show_in_menu' => 'hrw_wallet' , 'menu_icon' => HRW_PLUGIN_URL . '/assets/images/dash-icon.png' , 'supports' => array('title', 'editor','custom-fields'), 'show_in_rest' => true, 'query_var' => true , 'map_meta_cap' => true , 'rewrite' => false , 'capabilities' => array( 'create_posts' => 'do_not_allow' , ) ) ) ; } } HRW_Register_Post_Types::init() ;
}
the only problem is i get empty array at this custom post type endpoint.
https://localhost/jivipay/wp-json/wp/v2/hrw_wallet
the responses is []. please help
Forum: Plugins
In reply to: [Flutterwave Payments] Customizing Rave pay form with Shortcodesyou have to edit the plugin directly.
Goto rave-payment-forms/includes/rave-shortcode.php
around line 93 or there about
change this code:
$main_option_default = array(
‘amount’ => ”,
‘custom_currency’ => [],
’email’ => $email,
‘country’ => $admin_settings->get_option_value(‘country’),
‘currency’ => $admin_settings->get_option_value(‘currency’),
‘recurring_payment’ => $payment_plans_settings->get_option_value(‘recurring_payment’),
‘extra_count’ => count($extra_fields),
‘extra_checkbox_count’ => count($extra_fields_checkbox),
‘paymentplans’ => [
$payment_plans_settings->get_option_value(‘recurring_payment_plan_1’) => $plan_name_1,
$payment_plans_settings->get_option_value(‘recurring_payment_plan_2’) => $plan_name_2,
$payment_plans_settings->get_option_value(‘recurring_payment_plan_3’) => $plan_name_3,
$payment_plans_settings->get_option_value(‘recurring_payment_plan_4’) => $plan_name_4,
],to this code:
global $current_user;
get_currentuserinfo();$email_n = $current_user->user_email;
$current_user_id = get_current_user_id();
$first_name = get_user_meta($current_user_id, ‘first_name’, true);
$last_name = get_user_meta($current_user_id, ‘last_name’, true);$main_option_default = array(
‘amount’ => ”,
‘custom_currency’ => [],
’email’ => $email_n,
‘firstname’ => $first_name,
‘lastname’ => $last_name,
‘country’ => $admin_settings->get_option_value(‘country’),
‘currency’ => $admin_settings->get_option_value(‘currency’),
‘recurring_payment’ => $payment_plans_settings->get_option_value(‘recurring_payment’),
‘extra_count’ => count($extra_fields),
‘extra_checkbox_count’ => count($extra_fields_checkbox),
‘paymentplans’ => [
$payment_plans_settings->get_option_value(‘recurring_payment_plan_1’) => $plan_name_1,
$payment_plans_settings->get_option_value(‘recurring_payment_plan_2’) => $plan_name_2,
$payment_plans_settings->get_option_value(‘recurring_payment_plan_3’) => $plan_name_3,
$payment_plans_settings->get_option_value(‘recurring_payment_plan_4’) => $plan_name_4,
],after this, you don’t need to use the email shortcode anymore. it works of the box. only user the email shortcode for single user if you want.
Hope this Helps. Gracias.
- This reply was modified 4 years ago by biodun09.
open this file /rave-payment-forms/includes rave-base-class.php
search for the function process_payment() which should be on line 128
after this line $this->_add_post_meta( $payment_record_id, $post_meta );
add a do_action so that you can hook it from your function.php file
something like this: do_action(‘rave_payment_after_success’);
if you need some information from rave-payment after a successful transaction, pass $txn into the do_action like this: do_action(‘rave_payment_after_success’, $txn);
I don’t know what you need it for but here’s a tip to get data out of rave payment after a successful transaction
in your function.php file like this.
function rave_payment_after_success($txn){
$full_name = $_POST[‘customer’][‘fullName’];
$email = $_POST[‘customer’][’email’];
$amount = $txn->data->amount;
$customerid = $_POST[‘customer’][‘id’];
// do anything you want with the data.// let say you want to do add or update something for that particular user
// get the user id using the email.
$userid = email_exists( $email);
// hope it helps. Gracias
}