Comments (6)
Hi, resolve by my own. I use the filter aal_init_roles, see the next example.
add_filter( 'aal_init_roles', array( $this, 'aal_init_roles' ) );
public function aal_init_roles( $roles ) {
$roles_existing = $roles['manage_options'];
$roles['manage_options'] = array_merge( $roles_existing, array( "CustomRole" ) );
return $roles;
}
I insert using the next function aal_insert_log( $args );
aal_insert_log( array(
'action' => "Updated",
'object_type' => 'CustomRole',
'object_subtype' => "tooltips-attributes",
'object_name' => "Updated tooltips attributes. <div id='log_full_description' class='privanz_log_full'> " . $diff . "</div>",
) );
I need to insert more data in the description and i change the current type of the mysql column like the next script.
public function set_aryo_activity_log_column() {
global $wpdb;
$type = $wpdb->get_var( "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'wp_aryo_activity_log' AND column_name = 'object_name'" );
if ( $type == "varchar" ) {
$wpdb->query( "ALTER TABLE wp_aryo_activity_log CHANGE COLUMN object_name object_name blob" );
}
}
And finally i am saving a big json inside the description i change the column into the log table using the next code and insert a code to show a popup in the footer.
add_action( 'aal_table_list_column_description', array( $this, 'log_description' ), 10, 2 );
add_filter( 'admin_print_footer_scripts', array( $this, 'include_in_footer' ), 50 );
public function log_description( $return, $item ) {
if (strpos($return, 'log_full_description') !== false) {
$return = $return . " <a class='log_more_btn' href='#'>" . __( "more", "xxx" ) . "...</a>";
}
return $return;
}
public function include_in_footer() {
global $plugin_page;
if ( 'activity_log_page' != $plugin_page || ! is_admin() ) {
return;
}
....
}
I hope this code help to other!
www.gfirem.com
from activity-log.
Most definitely, @netconstructor!
What you can do is use the aal_insert_log()
method,
which will allow you to insert whatever event you'd like.
You can also take a look at some examples, found in the hooks directory within the plugin.
Good luck implementing!
from activity-log.
Thank you for your response. I have been attempting to implimented a custom logged activity hook through your plugin but I seem to be unable to get this implimented correctly.
I want to ensure my objective is properly implimented with minimal load on the system while properly hooking/logging all pageviews to any frontend pages (no backend page views) and only for those users who are properly logged in.
In your professional expertise and direct experience could you please clarify if my objective is far more involved than it should be? If possibly and not overly complicated I would greatly appreciate if you might be able to provide the proper code to achieve this properly. Greatly appreciate your help here in advance!
from activity-log.
Bump
from activity-log.
I have and issue like this, i insert the data with aal_insert_log()
but not showing in the list of logs, but is inserting in the data base, i miss something?
from activity-log.
Facing the same issue. as @gfirem. Any idea why the logs are not displayed in WP admin list ?
from activity-log.
Related Issues (20)
- Critical Exploit: CVE-2022-3941
- BUG: Export CSV Hebrew text has wrong encoding HOT 1
- Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated. HOT 1
- Username Display for login attempts
- Activity Log no longer recording website activity
- Delete logs after x days not working HOT 1
- Random Recording Of Activity Not Really Done
- N/A user log HOT 6
- Plugin must be hacked, it keeps advertising Elementor to me HOT 1
- Would like to filter by CONTEXT also
- Please edit that shows all states of the post HOT 1
- App is Showing Customer as Admin in Filter Section
- App is Hiding WooCommerce Save Button In Payment Gateway UI HOT 4
- Make IP collection optional HOT 1
- WordPress database error:[Illegal mix of collations / SELECT `histid` FROM `wpop_aryo_activity_log HOT 2
- [Request] Delete selected logs HOT 1
- Introduce filters in the aal_insert_log() function
- WordPress database error: [Illegal mix of collations (utf8mb3_general_ci,IMPLICIT) and (utf8mb4_unicode_520_ci,COERCIBLE) for operation
- Recommend running the aal_skip_insert_log filter before the duplicates check SQL query HOT 1
- Introduce filter to change settings page required capabilities
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activity-log.