Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Development
WordPress
Commits
5b770b8f
Commit
5b770b8f
authored
Jan 08, 2015
by
colemanw
Browse files
Merge pull request
#67
from christianwach/crm-14692-4.5
Keep WordPress functional during install process (4.5)
parents
1e60c38c
f5169de6
Changes
1
Hide whitespace changes
Inline
Side-by-side
civicrm.php
View file @
5b770b8f
...
...
@@ -75,6 +75,13 @@ if (!defined('CIVICRM_SETTINGS_PATH')) {
define
(
'CIVICRM_SETTINGS_PATH'
,
CIVICRM_PLUGIN_DIR
.
'civicrm.settings.php'
);
}
// test if Civi is installed
if
(
file_exists
(
CIVICRM_SETTINGS_PATH
)
)
{
define
(
'CIVICRM_INSTALLED'
,
TRUE
);
}
else
{
define
(
'CIVICRM_INSTALLED'
,
FALSE
);
}
// prevent CiviCRM from rendering its own header
define
(
'CIVICRM_UF_HEAD'
,
TRUE
);
...
...
@@ -210,6 +217,29 @@ class CiviCRM_For_WordPress {
// add CiviCRM access capabilities to WordPress roles
add_action
(
'init'
,
array
(
$this
,
'set_access_capabilities'
)
);
// only when in WordPress admin...
if
(
is_admin
()
)
{
// modify the admin menu
add_action
(
'admin_menu'
,
array
(
$this
,
'add_menu_items'
)
);
// check if settings file exist, do not show configuration link on
// install / settings page
if
(
!
isset
(
$_GET
[
'page'
]
)
||
(
isset
(
$_GET
[
'page'
]
)
&&
$_GET
[
'page'
]
!=
'civicrm-install'
)
)
{
if
(
!
CIVICRM_INSTALLED
)
{
add_action
(
'admin_notices'
,
array
(
$this
,
'show_setup_warning'
)
);
}
}
}
// go no further if Civi not installed yet
if
(
!
CIVICRM_INSTALLED
)
return
;
// synchronise users on insert and update
add_action
(
'user_register'
,
array
(
$this
,
'update_user'
)
);
add_action
(
'profile_update'
,
array
(
$this
,
'update_user'
)
);
...
...
@@ -224,8 +254,8 @@ class CiviCRM_For_WordPress {
// only when in WordPress admin...
if
(
is_admin
()
)
{
// m
odify the admin menu
add_action
(
'admin_
menu
'
,
array
(
$this
,
'
add_menu_items
'
)
);
// m
erge CiviCRM's HTML header with the WordPress theme's header
add_action
(
'admin_
head
'
,
array
(
$this
,
'
wp_head
'
)
);
// the following three hooks CiviCRM button to post and page screens
...
...
@@ -239,17 +269,6 @@ class CiviCRM_For_WordPress {
// add the javascript to make it all happen
add_action
(
'admin_enqueue_scripts'
,
array
(
$this
,
'add_form_button_js'
)
);
// check if settings file exist, do not show configuration link on
// install / settings page
if
(
isset
(
$_GET
[
'page'
]
)
&&
$_GET
[
'page'
]
!=
'civicrm-install'
)
{
if
(
!
file_exists
(
CIVICRM_SETTINGS_PATH
)
)
{
add_action
(
'admin_notices'
,
array
(
$this
,
'show_setup_warning'
)
);
}
}
// merge CiviCRM's HTML header with the WordPress theme's header
add_action
(
'admin_head'
,
array
(
$this
,
'wp_head'
)
);
// not in admin
}
else
{
...
...
@@ -306,7 +325,7 @@ class CiviCRM_For_WordPress {
}
// check for settings
if
(
!
file_exists
(
CIVICRM_SETTINGS_PATH
)
)
{
if
(
!
CIVICRM_INSTALLED
)
{
$error
=
FALSE
;
}
else
{
$error
=
include_once
(
CIVICRM_SETTINGS_PATH
);
...
...
@@ -545,7 +564,7 @@ class CiviCRM_For_WordPress {
public
function
add_menu_items
()
{
// check for settings file
if
(
file_exists
(
CIVICRM_SETTINGS_PATH
)
)
{
if
(
CIVICRM_INSTALLED
)
{
// use plugins_url( 'path/to/file.png', __FILE__ )
// see http://codex.wordpress.org/Function_Reference/plugins_url
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment