Skip to content

Instantly share code, notes, and snippets.

View hazratbilal0079's full-sized avatar
💭
I may be slow to respond.

Hazrat Bilal hazratbilal0079

💭
I may be slow to respond.
View GitHub Profile
@hazratbilal0079
hazratbilal0079 / css file
Last active September 11, 2024 12:23
Tabbed card layout in Html/CSS
.card.tabbed {
display: flex;
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
background: #fff;
margin: 20px;
}
@hazratbilal0079
hazratbilal0079 / How to save session time for each user in WordPress, monitor it in real-time
Last active August 29, 2024 05:12
How to save session time for each user in WordPress, monitor it in real-time
Note:
Create two meta fields in the user profile. In my case, the slug for the daily timing meta field is "usersessiontime"
and for the lifetime meta field, it is "user_daily_time" and for monthly record metafield is "monthly_session_store".
In case i set the idol time 20 seconds.
@hazratbilal0079
hazratbilal0079 / Hide Previous Repeater Fields while adding New in Edit with jQuery
Created June 24, 2024 06:54
Hide Previous Repeater Fields while adding New in Edit with jQuery
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
jQuery(document).ready(function($) {
// Hide all existing rows when the page loads
$('.jet-form-builder-repeater__row').hide();
// Attach a click event listener to the "Add New Comment" button
$('.jet-form-builder-repeater__new').on('click', function() {
// We need to wait for the new row to be added to the DOM
setTimeout(function() {
@hazratbilal0079
hazratbilal0079 / Register or Invite New User with Random Password and Custom Role from Frontend with PHP Hook or Code Snippet
Created June 6, 2024 09:37
Register or Invite New User with Random Password and Custom Role from Frontend with PHP Hook or Code Snippet
--Hook Name
registernewuseras
--PHP Hook
add_action( 'jet-form-builder/custom-action/registernewuseras', function( $request, $action_handler ) {
$username = sanitize_user($_POST['emailaddress']);
$email = sanitize_email($_POST['emailaddress']);
$first_name = sanitize_text_field($_POST['firstname']);
$last_name = sanitize_text_field($_POST['lastname']);
$password = sanitize_text_field($_POST['Password']);
@hazratbilal0079
hazratbilal0079 / Activate or Deactivate User Account through metafield and Update user Role from Frontend in WordPress with Hook or Code Snippet
Last active June 6, 2024 09:27
Activate or Deactivate User Account through metafield and Update user Role from Frontend in WordPress with Hook or Code Snippet
--Hook Name
updateuser
--PHP Hook
add_action( 'jet-form-builder/custom-action/updateuser', function( $request, $action_handler ) {
$user_id = $request['quer_user_id'];
$role = $request['user-current-role'];
$user_status = $request['user-current-status'];
@hazratbilal0079
hazratbilal0079 / Store Last Login Time in user Meta fields and Check User Status from a specific user Meta Field on Login Action through hook or Code Snippet in WordPress
Created June 6, 2024 09:20
Store Last Login Time in user Meta fields and Check User Status from a specific user Meta Field on Login Action through hook or Code Snippet in WordPress
--Hook Name
storelogin
--PhP Hook
add_action( 'jet-form-builder/custom-action/storelogin', function( $request, $action_handler ) {
// Get the user email from the request
$user_email = $request['login_email'];
// Get the user data by email
$user_data = get_user_by('email', $user_email);
@hazratbilal0079
hazratbilal0079 / Delete Multiple Tickets Based on Specified Criteria from a specific user or Delete All tickets of a user From Frontend in WordPress using hook or Code Snippet
Created June 6, 2024 09:17
Delete Multiple Tickets Based on Specified Criteria from a specific user or Delete All tickets of a user From Frontend in WordPress using hook or Code Snippet
--Hook Name
deleteownerdata
--PHP Hook
add_action('jet-form-builder/custom-action/deleteownerdata', function($request, $action_handler) {
// Sanitize the input fields to prevent any security issues
$property_name = isset($_POST['select_property']) ? sanitize_text_field($_POST['select_property']) : '';
$community_name = isset($_POST['community-name']) ? sanitize_text_field($_POST['community-name']) : '';
$responsible_person = sanitize_text_field($_POST['responsible_person']);
@hazratbilal0079
hazratbilal0079 / Assign Multiple Tickets or Properties or Update Single or Multiple Metafields from Frontend
Created June 6, 2024 09:05
Assign Multiple Tickets/Properties or Update Single or Multiple Metafields from Frontend in WordPress through hook or Code Snippet
--Hook Name
assignproperty
--Php Hook
add_action('jet-form-builder/custom-action/assignproperty', function($request, $action_handler) {
// Sanitize the input fields to prevent any security issues
$property_name = isset($_POST['select_property']) ? sanitize_text_field($_POST['select_property']) : '';
$community_name = isset($_POST['community-name']) ? sanitize_text_field($_POST['community-name']) : '';
$responsible_person = sanitize_text_field($_POST['responsible_person']);
@hazratbilal0079
hazratbilal0079 / Creating Terms with or without Parent from Frontend in WordPress
Created June 6, 2024 08:59
Creating Terms with or without Parent from Frontend in WordPress
--Hook Name
create_terms
--PHP Hook
add_action( 'jet-form-builder/custom-action/create_terms', function( $request, $action_handler ) {
$terms = explode(',', $request['terms']);
$taxonomy = $request['tax']; // Replace with your actual taxonomy name
@hazratbilal0079
hazratbilal0079 / Custom User Registration and Custom Role Assignment in WordPress with Meta Fields though hook
Created June 6, 2024 08:54
Custom User Registration and Custom Role Assignment in WordPress with Meta Fields though hook
--Hook name
registervisitor
--PHP Hook
add_action( 'jet-form-builder/custom-action/registervisitor', function( $request, $action_handler ) {
$username = sanitize_user($_POST['email']);
$email = sanitize_email($_POST['email']);
$first_name = sanitize_text_field($_POST['first-name']);
$user_status = sanitize_text_field($_POST['user-status']);