Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai-buddypress-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Noblogs
ai-buddypress-plugin
Commits
a5e9d62e
Commit
a5e9d62e
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parents
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ai-buddypress-plugin.php
+32
-0
32 additions, 0 deletions
ai-buddypress-plugin.php
buddypress-ai-filter-functions.php
+57
-0
57 additions, 0 deletions
buddypress-ai-filter-functions.php
with
89 additions
and
0 deletions
ai-buddypress-plugin.php
0 → 100644
+
32
−
0
View file @
a5e9d62e
<?php
/*
Plugin Name: Ai-buddypress-customize
Version: 0.0.1
Plugin URI: none
Description: Filtra alcuni parametri per la privacy
Author: A/I
*/
require_once
(
dirname
(
__FILE__
)
.
'/buddypress-ai-filter-functions.php'
);
add_action
(
'bp_has_activities'
,
'my_denied_activities'
,
10
,
2
);
//Utilizza gli avatar di buddypress se presenti
function
nfm_bp_avtar_upload_path_correct
(
$path
){
if
(
bp_core_is_multisite
()
){
$path
=
ABSPATH
.
get_blog_option
(
BP_ROOT_BLOG
,
'upload_path'
);
}
return
$path
;
}
add_filter
(
'bp_core_avatar_upload_path'
,
'nfm_bp_avtar_upload_path_correct'
,
1
);
function
nfm_bp_avatar_upload_url_correct
(
$url
){
if
(
bp_core_is_multisite
()
){
#$url = get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . "/wp-content/uploads";
$url
=
site_url
(
'wp-content/uploads'
);
}
return
$url
;
}
add_filter
(
'bp_core_avatar_url'
,
'nfm_bp_avatar_upload_url_correct'
,
1
);
?>
This diff is collapsed.
Click to expand it.
buddypress-ai-filter-functions.php
0 → 100644
+
57
−
0
View file @
a5e9d62e
<?php
function
my_is_friend_check
(
$friend_id
=
false
)
{
global
$bp
;
if
(
is_site_admin
()
)
return
true
;
if
(
!
is_user_logged_in
()
)
return
false
;
if
(
!
$friend_id
)
{
$potential_friend_id
=
$bp
->
displayed_user
->
id
;
}
else
{
$potential_friend_id
=
$friend_id
;
}
if
(
$bp
->
loggedin_user
->
id
==
$potential_friend_id
)
return
false
;
if
(
friends_check_friendship_status
(
$bp
->
loggedin_user
->
id
,
$potential_friend_id
)
==
'is_friend'
)
return
true
;
return
false
;
}
function
my_denied_activities
(
$a
,
$activities
)
{
//if admin we want to know
if
(
is_site_admin
()
)
return
$activities
;
foreach
(
$activities
->
activities
as
$key
=>
$activity
)
{
//new_member is the type name (component is 'profile')
if
(
$activity
->
type
!=
'new_blog_post'
&&
!
is_user_logged_in
())
{
unset
(
$activities
->
activities
[
$key
]
);
$activities
->
activity_count
=
$activities
->
activity_count
-
1
;
$activities
->
total_activity_count
=
$activities
->
total_activity_count
-
1
;
$activities
->
pag_num
=
$activities
->
pag_num
-
1
;
}
if
(
$activity
->
type
==
'new_blog_post'
&&
$activity
->
item_id
==
4437
)
{
unset
(
$activities
->
activities
[
$key
]
);
$activities
->
activity_count
=
$activities
->
activity_count
-
1
;
$activities
->
total_activity_count
=
$activities
->
total_activity_count
-
1
;
$activities
->
pag_num
=
$activities
->
pag_num
-
1
;
}
}
/* Renumber the array keys to account for missing items */
$activities_new
=
array_values
(
$activities
->
activities
);
$activities
->
activities
=
$activities_new
;
return
$activities
;
}
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment