• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Newsfreak - Flutter News App for WordPress

Newsfreak - Flutter News App for WordPress 2.1.2

No permission to download
@aloaax bro, Should we expect an update (the exclusive plugin) to this or find alternative solutions as the update is of no use if the main required files isn’t available.
 
  • Like
Reactions: ruibarbosa
Plugin is not displayed after activating.

It makes a direct purchase verification on the author's website, it is not nulled.

1692280257613.png
 
I’ll look into nulling the plugin. Can you provide more details
1. After activating, the plugin doesn’t show up in the installed plugin section?
 
to have nulled one , simply replace the content of newsfreak.php by this one
PHP:
<?php

/*
Plugin Name: Newsfreak App Functions
Plugin URI: https://1.envato.market/newsfreak
Description: This is a custom WordPress plugin from MRB Lab to configure the Newsfreak App.
Version: 1.0.0
Author: MRB Lab
Author URI: https://mrb-lab.com
*/


//rest api post extended
function newsfreak_rest_prepare_post($data, $post, $request)
{
    $_data = $data->data;
    $_data['custom']["featured_image"] = get_the_post_thumbnail_url($post->ID, "original") ?? '';
    $_data['custom']["author"]["name"] = get_author_name($_data['author']);
    $_data['custom']["author"]["avatar"] = get_avatar_url($_data['author']);
    $_data['custom']["categories"] = get_the_category($_data["id"]);
    $data->data = $_data;
    return $data;
}

add_filter('rest_prepare_post', 'newsfreak_rest_prepare_post', 10, 3);



// Enable comment without being loggedin
function filter_rest_allow_anonymous_comments()
{
    return true;
}

add_filter('rest_allow_anonymous_comments', 'filter_rest_allow_anonymous_comments');

add_action('rest_api_init', 'wp_rest_user_endpoints');


/* Handle Register User request. */
function wp_rest_user_endpoints($request)
{
    register_rest_route(
        'wp/v2',
        'users/register',
        array(
            'methods' => 'POST',
            'callback' => 'wc_rest_user_endpoint_handler',
        )
    );
}
function wc_rest_user_endpoint_handler($request = null)
{
    $response = array();
    $parameters = $request->get_json_params();
    $username = sanitize_text_field($parameters['username']);
    $email = sanitize_text_field($parameters['email']);
    $password = sanitize_text_field($parameters['password']);
    // $role = sanitize_text_field($parameters['role']);
    $error = new WP_Error();
    if (empty($username)) {
        $error->add(400, __("Username field 'username' is required.", 'wp-rest-user'), array('status' => 400));
        return $error;
    }
    if (empty($email)) {
        $error->add(401, __("Email field 'email' is required.", 'wp-rest-user'), array('status' => 400));
        return $error;
    }
    if (empty($password)) {
        $error->add(404, __("Password field 'password' is required.", 'wp-rest-user'), array('status' => 400));
        return $error;
    }

    $user_id = username_exists($username);
    if (!$user_id && email_exists($email) == false) {
        $user_id = wp_create_user($username, $password, $email);
        if (!is_wp_error($user_id)) {
            // Ger User Meta Data (Sensitive, Password included. DO NOT pass to front end.)
            $user = get_user_by('id', $user_id);
            // $user->set_role($role);
            $user->set_role('subscriber');
            // WooCommerce specific code
            if (class_exists('WooCommerce')) {
                $user->set_role('customer');
            }
            // Ger User Data (Non-Sensitive, Pass to front end.)
            $response['code'] = 200;
            $response['message'] = __("User '" . $username . "' Registration was Successful", "wp-rest-user");
        } else {
            return $user_id;
        }
    } else {
        $error->add(406, __("Email/Username already exists, please try 'Reset Password'", 'wp-rest-user'), array('status' => 400));
        return $error;
    }
    return new WP_REST_Response($response, 123);
}

//getting user info by id
add_filter('rest_request_before_callbacks', function ($response, $handler, $request) {

    if (WP_REST_Server::READABLE !== $request->get_method()) {
        return $response;
    }

    if (!preg_match('~/wp/v2/users/\d+~', $request->get_route())) {
        return $response;
    }

    add_filter('get_usernumposts', function ($count) {
        return $count > 0 ? $count : 1;
    });

    return $response;
}, 10, 3);

//delete user
function delete_my_user_account($request)
{
    if (is_user_logged_in()) {
        // Can't delete admin accounts
        if (current_user_can('manage_options')) {
            wp_send_json(
                array(
                    'status' => 'fail',
                    'title' => __('Error!', 'wp-delete-user-accounts'),
                    'message' => __('Administrators cannot delete their own accounts.', 'wp-delete-user-accounts')
                )
            );
        }

        // Get the current user data
        $user_id = get_current_user_id();

        // Get user meta data
        $meta = get_user_meta($user_id);

        // Delete user's meta data
        foreach ($meta as $key => $val) {
            delete_user_meta($user_id, $key);
        }


        // User Logout
        wp_logout();

        if (!function_exists('wp_delete_user')) {
            require_once(ABSPATH . 'wp-admin/includes/user.php');
        }

        // Delete the user's account
        $deleted = wp_delete_user($user_id);


        if ($deleted) {

            // Success
            return array(
                'status' => 'success',
                'title' => __('Success!', 'wp-delete-user-accounts'),
                'message' => __('Your account was successfully deleted. Fair well.', 'wp-delete-user-accounts')
            );

        } else {

            return array(
                'status' => 'fail',
                'title' => __('Error!', 'wp-delete-user-accounts'),
                'message' => __('Request failed.', 'wp-delete-user-accounts')
            );
        }
    }
}


//newsfreak configs with pod
add_action('rest_api_init', function () {
    register_rest_route(
        'remove_user/v1',
        'user/me',
        array(
            'methods' => 'DELETE',
            'callback' => 'delete_my_user_account'
        )
    );
});

function register_custom_settings_endpoint()
{
    register_rest_route(
        'newsfreak',
        '/configs',
        array(
            'methods' => 'GET',
            'callback' => 'get_settings_data',
        )
    );
}
add_action('rest_api_init', 'register_custom_settings_endpoint');

function get_settings_data()
{

    $homeCategories = get_option('newsfreak_configs_home_categories');
    $postDetailsLayout = get_option('newsfreak_configs_post_details_layout');
    $blockedCategories = get_option('newsfreak_configs_blocked_categories');
    $supportEmail = get_option('newsfreak_configs_support_email');
    $privacyPolicy = get_option('newsfreak_configs_privacy_policy');
    $postIntervalCount = get_option('newsfreak_configs_post_interval_count');


    $fb = get_option('newsfreak_configs_fb');
    $youtube = get_option('newsfreak_configs_youtube');
    $instagram = get_option('newsfreak_configs_instagram');
    $twitter = get_option('newsfreak_configs_twitter');
    $threads = get_option('newsfreak_configs_threads');

    $menubarEnabled = get_option('newsfreak_configs_menubar_enabled');
    $logoPositionCenter = get_option('newsfreak_configs_logo_position_center');
    $popularPostEnabled = get_option('newsfreak_configs_popular_post_enabled');
    $featuredPostEnabled = get_option('newsfreak_configs_featured_post_enabled');
    $welcomeScreenEnabled = get_option('newsfreak_configs_welcome_screen_enabled');
    $commentsEnabled = get_option('newsfreak_configs_comments_enabled');
    $loginEnabled = get_option('newsfreak_configs_login_enabled');
    $socialLoginsEnabled = get_option('newsfreak_configs_social_logins_enabled');
    $fbLoginEnabled = get_option('newsfreak_configs_fb_login_enabled');
    $multiLanguageEnabled = get_option('newsfreak_configs_multilanguage_enabled');
    $purchaseCode = get_option('newsfreak_configs_purchase_code');
    $purchaseValid = get_option('newsfreak_configs_purchase_valid');
    $onboardingEnabled = get_option('newsfreak_configs_onboarding_enabled');
    $socialEmbeddedEnabled = get_option('newsfreak_configs_social_embedded_enabled');
    $videoTabEnbaled = get_option('newsfreak_configs_video_tab_enbaled');

    $customAdsEnabled = get_option('newsfreak_configs_custom_ads_enabled');
    $customAdDestinationUrl = get_option('newsfreak_configs_custom_ad_destination_url');
    $customAdPlacements = get_option('newsfreak_configs_custom_ad_placements');

    $admobEnabled = get_option('newsfreak_configs_admob_enabled');
    $bannerAdsEnabled = get_option('newsfreak_configs_banner_ads_enabled');
    $interstitialAdsEnabled = get_option('newsfreak_configs_interstitial_ads_enabled');
    $clickAmount = get_option('newsfreak_configs_click_amount');
    $nativeAdsEnabled = get_option('newsfreak_configs_native_ads_enabled');
    $nativeAdPlacements = get_option('newsfreak_configs_native_ad_placements');


    $customAdAsset = get_option('newsfreak_configs_custom_ad_asset');
    $assetUrl = pods_image_url($customAdAsset, 'null');





    $isValid = true;

 

    $settings = null;
    if ($isValid == true) {
        $settings = array(
            'home_categories' => $homeCategories,
            'post_details_layout' => $postDetailsLayout,
            'blocked_categories' => $blockedCategories,
            'post_interval_count' => $postIntervalCount,
            'support_email' => $supportEmail,
            'privacy_policy_url' => $privacyPolicy,
            'fb_url' => $fb,
            'youtube_url' => $youtube,
            'instagram_url' => $instagram,
            'twitter_url' => $twitter,
            'threads_url' => $threads,
            'menubar_enabled' => $menubarEnabled,
            'logo_position_center' => $logoPositionCenter,
            'popular_post_enabled' => $popularPostEnabled,
            'featured_post_enabled' => $featuredPostEnabled,
            'welcome_screen_enabled' => $welcomeScreenEnabled,
            'comments_enabled' => $commentsEnabled,
            'login_enabled' => $loginEnabled,
            'social_logins_enabled' => $socialLoginsEnabled,
            'fb_login_enabled' => $fbLoginEnabled,
            'multilanguage_enabled' => $multiLanguageEnabled,
            'valid' => $isValid,
            'social_embedded_enabled' => $socialEmbeddedEnabled,
            'onboarding_enabled' => $onboardingEnabled,
            'video_tab_enabled' => $videoTabEnbaled,
            'custom_ads_enabled' => $customAdsEnabled,
            'custom_ad_asset' => $assetUrl,
            'custom_ad_destination_url' => $customAdDestinationUrl,
            'custom_ad_placements' => $customAdPlacements,
            'admob_enabled' => $admobEnabled,
            'banner_ads_enabled' => $bannerAdsEnabled,
            'interstitial_ads_enabled' => $interstitialAdsEnabled,
            'click_amount' => $clickAmount,
            'native_ads_enabled' => $nativeAdsEnabled,
            'native_ad_placements' => $nativeAdPlacements,
        );
    }


    return $settings;
}


// featured post query
function featured_post_query($args, $request)
{
    // Check if the request is for the default posts endpoint and a specific custom parameter exists
    if ($request->get_route() === '/wp/v2/posts' && $request->get_param('featured')) {
        $args['meta_query'] = array(
            array(
                'key' => 'featured',
                'value' => '1',
                'compare' => '=',
            ),
        );
    }

    return $args;
}
add_filter('rest_post_query', 'featured_post_query', 10, 2);



// video post query
function video_post_query($args, $request)
{
    // Check if the request is for the default posts endpoint and a specific custom parameter exists
    if ($request->get_route() === '/wp/v2/posts' && $request->get_param('video')) {
        $args['meta_query'] = array(
            array(
                'key' => 'video_post',
                'value' => '1',
                'compare' => '=',
            ),
        );
    }

    return $args;
}
add_filter('rest_post_query', 'video_post_query', 10, 2);



// social logins
add_action('rest_api_init', 'wp_rest_social_endpoints');


function wp_rest_social_endpoints($request)
{
    register_rest_route(
        'wp/v2',
        '/social-login',
        array(
            'methods' => 'POST',
            'callback' => 'wc_rest_social_endpoint_handler',
        )
    );
}



function wc_rest_social_endpoint_handler($request = null)
{
    $response = array();
    $username = $request->get_param('username');
    $email = $request->get_param('email');

    $error = new WP_Error();
    if (empty($username)) {
        $error->add(400, __("Username field 'username' is required.", 'wp-rest-user'), array('status' => 400));
        return $error;
    }
    if (empty($email)) {
        $error->add(401, __("Email field 'email' is required.", 'wp-rest-user'), array('status' => 400));
        return $error;
    }

    $user_id = username_exists($username);
    if (!$user_id && email_exists($email) == false) {
        $random_password = wp_generate_password();
        $user_id = wp_create_user($username, $random_password, $email);
        if (!is_wp_error($user_id)) {
            $user = get_user_by('id', $user_id);
            $user->set_role('subscriber');

            // WooCommerce specific code
            if (class_exists('WooCommerce')) {
                $user->set_role('customer');
            }

            $response = array(
                'code' => 200,
                'message' => 'New User',
                'email' => $user->data->user_email,
                'username' => $user->data->user_login,
            );
        } else {
            $error->add(406, __("Error on creating new account'", 'wp-rest-user'), array('status' => 400));
            return $error;
        }
    } else {
        $user = get_user_by('id', $user_id);
        if ($user != false) {
            $response = array(
                'code' => 200,
                'message' => 'User Exists',
                'email' => $user->data->user_email,
                'username' => $user->data->user_login,
            );
        } else {
            $error->add(406, __("Error on login account'", 'wp-rest-user'), array('status' => 400));
            return $error;
        }
    }
    return new WP_REST_Response($response, 123);
}

and enter a code (in number) in envato purchase code in Newsfreak config( wordpress extension) and voila :D
 
Has anyone tried using version 2.0.4?

On any base url it the app says it has no internet connection

1693963964686.png
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock