Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/functions-ur-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
}

if ( ! function_exists( 'ur_check_module_activation' ) ) {
/**

Check failure on line 16 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment for parameter "$module" missing
* Check if provided module is activated or not.
*
* @param string Module key to check.

Check failure on line 19 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Missing parameter name
*
* @return bool
*/
Expand Down Expand Up @@ -429,7 +429,7 @@
update_option( 'ur_membership_default_membership_field_name', $membership_field_name );

$membership_id = UR_Install::create_default_membership();
// $membership_group_id = ::create_default_membership_group( array( array( 'ID' => "$membership_id" ) ) );

Check warning on line 432 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

This comment is 58% valid code; is this commented out code?

$pages = apply_filters( 'user_registration_create_pages', array() );
$default_form_page_id = 0;
Expand Down Expand Up @@ -498,7 +498,7 @@

$roles = array();
if ( ! isset( $wp_roles ) ) {
$wp_roles = new WP_Roles();

Check failure on line 501 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Overriding WordPress globals is prohibited. Found assignment to $wp_roles
}
$roles = $wp_roles->roles;

Expand All @@ -515,8 +515,8 @@


if ( ! function_exists( 'check_membership_field_in_form' ) ) {
/**

Check failure on line 518 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment for parameter "$form_id" missing
* check_membership_field_in_form

Check failure on line 519 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Doc comment short description must start with a capital letter
*
* @return bool
*/
Expand All @@ -538,13 +538,13 @@
/**
* Get or initialize the membership process structure for a user.
*
* @param int $user_id

Check failure on line 541 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Missing parameter comment
* @return array
*/
function urm_get_membership_process( $user_id ) {
$process = get_user_meta( $user_id, 'urm_membership_process', true );

// If nothing is stored, initialize fresh structure

Check failure on line 547 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Inline comments must end in full-stops, exclamation marks, or question marks
if ( empty( $process ) || ! is_array( $process ) ) {
$process = array(
'upgrade' => array(),
Expand All @@ -555,7 +555,7 @@
return $process;
}

// Ensure all keys exist

Check failure on line 558 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Inline comments must end in full-stops, exclamation marks, or question marks
if ( ! isset( $process['upgrade'] ) || ! is_array( $process['upgrade'] ) ) {
$process['upgrade'] = array();
}
Expand All @@ -582,12 +582,16 @@
* @param array $allowed_memberships Allowed memberships for access.
*/
function urm_check_user_membership_has_access( $allowed_memberships ) {
$members_subscription = new \WPEverest\URMembership\Admin\Repositories\MembersSubscriptionRepository();
if ( is_super_admin() ) {
return true;
}

if ( ! is_user_logged_in() ) {
return false;
}

$members_subscription = new \WPEverest\URMembership\Admin\Repositories\MembersSubscriptionRepository();

$user_memberships = $members_subscription->get_member_subscription( wp_get_current_user()->ID );

if ( empty( $user_memberships ) ) {
Expand Down Expand Up @@ -827,7 +831,7 @@

foreach ( $modules as $module_key => $function_name ) {
if ( ! function_exists( $function_name ) ) {
eval(

Check failure on line 834 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

eval() is a security risk so not allowed.
"
function $function_name() {
return ur_check_module_activation('$module_key');
Expand All @@ -836,4 +840,4 @@
);
}
}
// deprecating function code ends

Check failure on line 843 in modules/functions-ur-modules.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Inline comments must end in full-stops, exclamation marks, or question marks
Loading